Introduction to the new mainfame
Transcript of Introduction to the new mainfame
Introduction to the new mainfame
© Copyright IBM Corp., 2005. All rights reserved.
Chapter 12: Databases
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
ObjectivesIn this chapter, you will learn:
• DB2 concepts• The DB2 system structure• DB2 for z/OS architecture• How to invoke SQL on z/OS• Application programming with DB2• Managing DB2• IMS-DB
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Key terms in this chapter• unit of work• DBMS• SPUFI• SQLJ• SYSADM• EXPLAIN• view• modified source
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
DB2 Concepts: Data Structures
VSAMLDS
VSAMLDS
Storage group
Data base
Table Space
Table
Index Space
Index
Views
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Schema structures
• User-defined Data Type (UDT)• User-defined Function (UDF)• Triggers• Large Object (LOB)• Stored Procedure
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
System Structure
Catalog and Directory: stores ALL DB2 informationBuffer PoolActive and Archive LogsBootstrap data set (BSDS)
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
DB2 for z/OS ArchitectureDB2 Address Spaces
• System Service address space (SSAS)• Database Service address space (DBAS)• Internal Resource Lock Manager (IRLM)
DB2 Attachment Facilities• CICS• IMS• TSO
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Invoke SQL on z/OS: SPUFI
Select option 1 to enter SPUFI
First you need to create the output file (if not existing)
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Invoke SQL on z/OS: SPUFI (continued)
Enter the input and output dataset, if they are not yet in place.Change the member of the PDS, if you want to enter a new SQLDefaults are set to NO from YES.
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Invoke SQL on z/OS: SPUFI (continued)
Enter the SQL statement you want to execute. Press F3 to return to the previous screen (to execute the SQL).
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Invoke SQL on z/OS: SPUFI (continued)
When you get back to this screen, the “edit input” is put to “*”.Press ENTER to execute the SQL and to see the output.
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Invoke SQL on z/OS: SPUFI (continued)
F8 brings the rest of the results on your screen
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Invoke SQL on z/OS: SPUFI (continued)
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Application Programming: the flow
SourceSourceProgramProgram
Precompile
IncludeIncludeMemberMember
Compile
Linkedit
ModifiedSource
Object Module
Load Module
DBRM
Bind
Package
Bind
Plan
DCLGEN
RUN
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Get the access path: EXPLAIN
EXPLAIN ALL SET QUERYNO = 1SELECT EMPNO, LASTNAME
FROM EMPWHERE LASTNAME = 'MILLER';
-The query is NOT executed-The access path is placed in userid.PLAN_TABLE, if it exists
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Other development options
• ODBC• JAVA• SQLJ• JDBC• XML• XML Column Access• XML Collection Access
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Managing DB2: System Administration
InstallationSystem Object ManagementSystem and Disaster RecoveryMonitoring System Performance
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Managing DB2: Database Administration
Creation and management of DB2 objectsExecution of utilities:
• Data Organization• Backup and recovery• Data Consistency
Commands
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Functions of the IMS DM
A DBMS provides:• A single copy of data for access by multiple users • Maintenance of integrity across all updates• Minimization of HW and OS access method
dependencies• Reduction of data redundancy
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Implementation of IMS Databases
Depending on user requirementsTechnologies :
• IMS DB or DL/I or DL1 or Full Function Database
• IMS DEDB or Data Entry DB or Fast Path Database
• IMS Main storage database (MSDB)
• IBM DB2
Database Recovery Control (DBRC)
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Structure of IMS DB Subsystem
System Address SpaceApplication Region Address Space
Up to 99 in total
DLISeparateAddressSpace
DBRCRegion
MPP IFP BMP
ApplicationProgram
Full Function DBs RECONs
DependentRegion
AddressSpace
IMS System
IMS Libraries
IMS Message Queues
Logs
Fast Patch DBs
ControlRegion
AddressSpace
Network
JavaMessage
Processing
JavaBatch
ProcessingApplicationProgram
ApplicationProgram
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Databases used by IMS: Database basics
Access pathsNormalization within IMS
• Unique entities• One occurrence only• No many-to-many relationships
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Databases used by IMS: DB ModelSequence to access the segments
ROOT(1)
Segment A2(8)
Segment A1(2)
Segment D3(9)
Segment D2(4)
Segment E3(7)
Segment D1(3)
Segment E2(6)
Segment E1(5)
Segment B2(14)
Segment B1(10)
Segment G2(12)
Segment H1(13)
Segment G1(11)
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Databases used by IMS: DB model
Additional access paths to segments• Logical relationships• Secondary indices
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Application programming overview
Program is subroutine of IMS region controller• Needs a program specification block (PSB)• Uses services:
• Send/receive message from terminals• Access db• Issue IMS commands• Issue IMS service calls
example: Checkpoint calls, Sync call
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Program Structure
Segments Segments to/from to/from
databasesdatabases
ENTRy
EXIT
DLI modules
Call infoCall infofrom DLIfrom DLI
PCB-Mask
IO AREA
Application Program
PROGRAM ENTRYDEFINE PCB AREASGET INPUT RECORDS FROM INPUT FILECALLS TO DL/I DB FUNCTIONS
RETRIEVEINSERTREPLACEDELETE
CHECK STATUS CODESPUT OUTPUT RECORDSTERMINATION
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
IMS and the World Wide WebMessage flow in IMS transactions
3270 Terminal
1,2
VTAM IMS MPP
3 4,5
8,9 7 6
NCP
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
IMS and the World Wide WebMessage flow between Web browser and Web server
Web Browser
1,2
WebServer
CGIProgram
3 4,5
8,9 7 6
TCP/IP TCP/IP
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
IMS and the World Wide WebMessage flow IMS transaction and Web server CGI programs
3270 Terminal
1,2
VTAM IMS MPP
3 4,5
8,9 7 6
NCP
Web Browser
1,2
WebServer
CGIProgram
3 4,5
8,9 7 6
TCP/IP TCP/IP
Program to ProgramCommunications
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
SummaryIn this chapter, you learned:
• Some DB2 concepts• The DB2 system structure• DB2 for z/OS architecture• How to invoke SQL on z/OS• Application programming with DB2• Managing DB2• IMS-DB
Introduction to the new mainfame
© Copyright IBM Corp., 2005. All rights reserved.
Database Exercises
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
DB2 Interactive
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Default panel 1
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Default panel 2
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
DCLGEN
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Do the exercise• Do the DCLGEN• Execute the SQL (change it if you want)• Change the program• Execute the job
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Execute from TSO Allocate your datasets first (1)Change your parameters and press enter (2)
1
2
2
Introduction to the new mainframe
© Copyright IBM Corp., 2005. All rights reserved.
Execute from TSO (continued): results