Professional Documents
Culture Documents
Ims DB
Ims DB
Course Details
No: Name C018 IMS DB Fundamentals
Introduction IMS is a hierarchical Database. This material provides an insight into the Fundamentals of IMS DB and DL/I calls.
Course Details
Pre-Requisite Knowledge of Databases
SRA videos-32804/32807
To be decided by the CR and SWS Class Room Attendance > 80 % and/or (Case study Completion or Test score > 50 %)
Lesson Plan
M# Topic Time(hrs) 1 Introduction to IMS DB 1 2 Introduction to IMS DB 3 3 4 5 6 7 8 9
Module 1- Introduction
Topics Duration : 1 hour
Different type of Databases What is IMS DB ? Terminology :- Segments, PSBs, PCBs Main elements in an IMS application program
Module 2- Introduction
Topics DL/I calls Duration : 3 hours
Peer Review
This material is made for EBSCO project training program. As it is project specific, it will not be peer reviewed.
Module 1- Introduction
Topics
Duration : 1 hour
Introduction
DBMS:-
IMS /VS : Information Management System / Virtual Storage Hierarchical DBMS IMS DB is to DB2 as DL/I is to SQL. IMS DB is DBMS and DL/I is DML IMS DBs use VSAM data sets, either KSDS or RRDS to store data.
DEALER
MODEL
ORDER
STOCK
SALES
Segments
Unit of data that DL/I transfers to and from your program in an I/O operation. Segment Type: Category of data Segment Occurrence: One specific segment of a particular type of data. Unlimited occurrences of each segment type. Root Segment,Parent-child, Twin Segment
One Root Segment (with many instances) Each root segment - Unique Key Root Segment - Entry point to DB IMS the limit is 15 levels, from root to lowest child.
DBDs
DBDs defines the individual segment types to be contained in the data base and their relationship. What is DBDGEN? DBDLIB
PSBs
DBA designs a selected or logical view of the database for each program that will access it. Each programs view is then recorded in a control block called Program communication Block. PCB also indicates the access type the program has w.r.t segment, RD/UPD/WR/DEL
Example of DBD
Explain this with a DBD of the project, for which the training is being conducted.
Example of PSB
PCB TYPE=DB, DBDNAME=ANDODBP, PROCOPT=GO, KEYLEN=25 SENSEG NAME=OHSOMST, PARENT=0 SENSEG NAME=OHSOCTL,PARENT=OHSOMST SENSEG NAME=OHSOADJ,PARENT=OHSOCTL SENSEG NAME=OHSOAEX,PARENT=OHSOADJ SENSEG NAME=OHSOCLM,PARENT=OHSOCTL PSBGEN LANG=COBOL, PSBNAME=ANBFSTO END
PSBs
A DBD describes the content and hierarchical structure of the physical or logical database. DBDs also supply information to IMS in order to help in locating segments. A PSB specifies the database segments an application program can access and the functions it can perform on the data, such as read only, update,or delete. Because an application program can access multiple databases,PSBs are composed of one or more program control blocks (PCBs). The PSB describes the way a database is viewed by your application program
p
p
PSB
DBD1
DB1
Linkage Section
DL/I
passes control to your program, it also supplies the address of each PCB in PSB.
PCB Masks
01 PCB-AREA-1. 02 02 02 02 02 02 02 02 02 DBD-NAME-1 SEG-LEVEL-1 STATUS-CODE-1 PROCESS-OPTIONS-1 FILLER SEG-NAME-FDBK-1 LENGTH-FB-KEY-1 NUMB-SENS-SEGS-1 KEY-FB-AREA-1 PIC PIC PIC PIC PIC PIC PIC PIC X(8). XX. XX. X(4). S9(5) COMP. X(8). S9(5) COMP. S9(5) COMP.
PIC X(75).
Entry Stmt
Entry stmt provides a mechanism for DL/I to transfer control to your pgm. GOBACK: To be coded to pass control back to DL/I after pgm is completed. ENTRY DLITCBL USING pcb-name1, pcb-name2.
Module 2
Topics Duration : 3 hours DL/I - dB Call processing DL/I calls
DL/1 DB processing
Application pgm DL/1
Application Programming
Using a sample program and explain the links between Linkage Section, Entry Stmt & JCL.
DL/1
A DL/I call consists of a call statement and a list of parameters. The parameters provide information that IMS needs to execute the call. This information consists of the call function, the name of the data structure that IMS uses for the call, the data area in the program into which IMS returns data, and any condition that the retrieved data must meet.
DL/1 Calls
CLSE DEQ DLET FLD GHN GHNP GHU GN GNP GU ISRT OPEN POS REPL GSAM Close Dequeue Delete Field Get Hold Next Get Hold Next in Parent Get Hold Unique Get Next Get Next in Parent Get Unique Insert GSAM Open Position Replace
Get Functions
Similar to Read stmt Two groups of Get Functions GU, GN, GNP GHU, GHN, GHNP Hold Functions: Specify an intent to update a segment after you retrieve it.
SSA
Segment Search Argument: Specifies info required by IMS to process a Dl/1 call.
DL/1 call : Qualified / Unqualified SSAs : Qualified SSA Unqualified SSA Unqaulified SSA: Contains only segment name Qualified SSA: Includes one or more more than one qualification to identify a segment occurrence.
Unqualified SSA
Unqualified SSA format
1
Segment Name 01 Unqualified-ssa. 03 unqual-ssa-segment name Pic x(8). 03 Filler Pic x value space.
Qualified SSA
18 19 20 n n+1
(
Segment name Field name Relational Operator Search value
COBOL code for a qualified SSA 01 VENDOR-SSA. 05 FILLER 05 FILLER 05 VENDOR-SSA-CODE 05 FIILER
Relational Operators
Equal To Not Equal To Greater than Less than or equal to Greater than Or equal to Less than EQ NE GT LE GE LT <= => < <= =
Command Codes
Extend the functions of DL/1 calls. Using Command codes help in performance improvement Some command codes: D Path Call F First Occurrence L Last Occurrence N Path call ignore - Null Command Code
Qualified SSA
Qualified SSA format with a single command code
1
8 9 10 11 12
19 20 21 22
N+1
*Segment name
*-
...
Search Value
Status Code
GE : Segment Not Found GB: End of dB
Sequential Retrieval:GN
Basic Sequential Processing: GN After a successful call, DB position is immediately before segment occurrence in the hierarchical sequence. GN call moves forward through the database from the position established by the previous call.
Example:
Discuss Program 45. (Page 52).
Status Codes: GA
Example: Retrieve all location segment occurrences that have a sequence field value NYC. Call CBLTDLI using GN IO-PCB SEGMENT-IO STOCK-LOCATION-SSA.
GNP
Sequential retrieval within established parentage. Similar to GN, except it retrieves segments that are subordinate to current established parent. Establish Parentage by successful GU or GN call. Segment returned by this call is parent. Discuss 5.1 (Page 77 & Page 88) Status Code: GP (If GNP is issued without establishing parentage).
D Command Code
DL/I operates on the lowest level segment you specify in an SSA. Ref Ex: Program 94 Path Call: A call with an SSA that includes the D command code Improves Performance of Pgms PROCOPT in PCB should have P How to exclude a segment from a path call.
C Command Code
If only the Lowest level segment is required to be retrieved. No need to code separate SSAS. Just one single SSA DL/I operates on the lowest level segment you specify in an SSA.
ISRT Call
CALL CBLTDLI USING DLI-ISRT INVENTORY-PCB LOCATION-SEGM UNQUAL-SSA. USING DLI-ISRT INVENTORY-PCB LOCATION-SEGM VENDOR-SSA ITEM-SSA UNQUAL-SSA.
CALL CBLTDLI
REPL
CALL CBLTDLI USING GHU INVENTORY-PCB Location-SEGMENT VENDOR-SSA ITEM-SSA LOCATION-SSA. . . CALL CBLTDLI USING REPL INVENTORY-PCB LOCATION-SEGMENT.
Secondary Indexing
If an application has to access a segment using a field other than the sequence field a secondary index could be used. You can index any field in a segment by defining an XDFLD statement for the field in the DBD for the database. If the Get call is not qualified on the key but uses some other field, IMS must search all the database records to find the correct record.
Guidelines - S.Indexing
Define the indexed field in the DBD for the primary database in the XDFLD statement during DBD generation. Use the name that was given on the XDFLD statement as the field name in the qualification statement. Specify the secondary index as the processing sequence during PSB generation. Do this by specifying the name of the secondary index database on the PROCSEQ parameter on the PCB during PSB generation.