IMS DB DLI Call IMS Training Class 05
IMS DB DL/I Call IMS Training Class 05
DL/I Calls IMS services are requested via DL/I calls , in a COBOL program a CALL 'CBLTDLI‘ statement is used whenever a DL/I service is required. The general command format is CALL ‘CBLTDLI’ USING PARM-COUNT, DLI-FUNCTION, PCB-MASK, IO-AREA, SSA.
CBLTDLI Parameters Function Code: This is the first parameter in the list. It names a four byte function code for the service requested from DL/I such as Insert, Update, Delete, and Browse of database. PCB Mask Name: - This is the second parameter in the list. It names the PCB mask of the Database. After execution of the DL/I call, IMS will load the PCB mask specified in the call with the execution result. INPUT-OUTPUT : This is the third parameter in the list. This area is used by DL/I to put a retrieved segment or by the Application program to store the data of a segment prior to addition or updation.
CBLTDLI Parameters Segment Search Argument: This is the fourth parameter in the list. This is optional. Whenever specified, DL/I uses it to narrow the field of search to a particular segment type or to a particular segment occurrence to be manipulated at each level of database. There can be maximum of 1 SSA per level up to 15 SSA's for each database. There are calls with three options: § Without SSA's § With unqualified SSA's § With combination of Qualified & Unqualified SSA's
Segment Search Arguments SSAs allow the application program to define to IMS the type of database access required. There are two types of calls to IMS: Qualified Call: The application program provides an SSA telling IMS what segment to access. Unqualified Call: The application does not provide an SSA. IMS will determine what segment to process. For retrieval calls, IMS reads the next segment in the database; for update call, IMS processes the segment which has been held. For qualified calls, there are two types of SSAs: Unqualified SSA: Only the segment name is provided by the application program. Qualified SSA: More information than just the segment name is provided by the application.
SSA Types Unqualified SSA : This only specifies the SEGMENT TYPE the program is interested in. Here you don't indicate a particular occurrence of a segment. The segment name is first eight Characters padded by space up to the eighth position followed by a space in the ninth position instead of a left parenthesis. Qualified SSA : In addition to the SEGMENT TYPE, also contains one or more qualification statements. A qualified SSA describes the segment occurrence a program wants to access. This statement has 3 parts enclosed in parenthesis. The 1 st part names The field that DL/I will use for segment search. The second part names the Relational Operator of two bytes telling DL/I what kind of comparison to make during the search. The third part is a Variable length field that contains the values for comparison
Unqualified SSA . POS 1 -8 9 DESCRIPTION SEGMENT NAME BLANK 01 UNQUAL-SSA. 05 SEGMENT-NAME PIC X(9) VALUE ‘CLIENT ‘.
Qualified SSA . POS DESCRIPTION 1 -8 SEGMENT NAME 9 -9 LEFT PARANTHESES 10 -17 KEY NAME FROM DBD 18 -19 RELATIONAL OPERATOR 20 -XX VALUE OF KEY FIELD MUST BE LENGTH OF KEY XX+1 RIGHT PARANTHESES
Relational Operators Relational operators define the equation for the segment access. The valid operators are as follows. EQUAL: ‘ =‘ OR ‘EQ’ GREATER THAN: ‘ >‘ OR ‘GT’ LESS THAN : ‘ < ‘ OR ‘LT’ GREATER THAN OR EQUAL TO : ‘=>‘ OR ‘GE’ LESS THAN OR EQUAL TO : ‘=<‘ OR ‘LE’ NOT EQUAL TO : ‘=/‘ OR ‘NE’
Qualified SSA Example 01 CLIENT-SSA. 03 SEG-NAME PIC X(8) VALUE ‘CLIENT'. 03 LEFT-PAREN PIC X VALUE '('. 03 KEY-FIELD PIC X(8) VALUE ‘CLDCODE'. 03 FILLER PIC X(2) VALUE 'EQ'. 03 KEY-VALUE PIC X(6) VALUE '123456'. 03 FILLER PIC X VALUE ')‘.
Types Of Database DL/I Calls There are five types of database DL/I calls. They are GET CALLS (GU, GN and GNP) GET HOLD CALLS (GHU, GHN and GHNP) INSERT CALL (ISRT) DELETE CALL (DLET) REPLACE CALL (REPL)
DL/I Functions GU GN GNP GHU GHNP ISRT REPL DLET CHKP XRST - Get Unique Get Next within Parent Get Hold Unique Get Hold Next within Parent Insert Replace Delete Checkpoint Call Restart
DL/I Processing Segments in an IMS database can be Retrieved in one of two ways. Sequential processing: The data base is processed in sequence from some starting point. The order of the retrieval of the segments is determined by their physical order on the database. Random processing: The database is not retrieved in any order. The application program asks for a specific segment identified by some field in the segment (usually the key) In addition to retrieval, an application can Add, Change or Delete segments.
Sequential Processing The segment retrieved is always based on the prior segment retrieved; the search for the next segment starts at the current position. The segment is retrieved based on several factors: § § § The hierarchy of the database. The qualification coded in the application. The segments which have been defined in the PCB, i. e. , segment sensitivity.
Sequential Processing Functions GN : ‘Get Next’ - To retrieve the next segment in the database. GNP: ‘Get Next Within Parent’ - To retrieve the next dependent segment of this parent. GHN: ‘Get Hold Next’ - To retrieve and hold (for update) the next segment. GHNP: ‘Get Hold Next Within Parent’ - To retrieve and hold (for update) the next dependent segment of this parent. An unqualified get next retrieves the next sensitive segment in the hierarchy. A qualified next retrieves the next sensitive segment matching the search criteria.
Sequential Retrieval Using GN Call § This retrieves a series of segments in Sequential order § GN call is issued to retrieve the next segment occurrence from the current database position established by a GU or GN call. DL/I will start the search from current position forward to try to satisfy the call. § Unqualified GN calls will traverse through the entire database § It is difficult to figure out when you will go up in level, go down in level, or stay at the same level in database. § DL/I Sequential Processing sequence within a database is always Top to Bottom, Left to Right and Front to Back along Twin occurrences
GN Calls - Status Codes When issued without SSA's (unqualified GN call) three values are returned GA - Moved up in level to retrieve the segment GK - New segment type at the same level is retrieved GB - End of database is reached When issued with Unqualified SSA's (Qualified GN call) one value is returned GB - End of database is reached When issued with qualified SSA's (Qualified GN call) two values are returned BLANK - Segment successfully retrieved GE - Segments not found following the current position
Random Retrieval Using GU Call This retrieves a unique segment occurrence randomly. This is a fully qualified call wherein the program supplies a fully qualified SSA for each level in the hierarchy down to the segment being retrieved. GU call is also used to set up the Parentage at the retrieved segment occurrence for the subsequent GNP or GHNP calls issued in the program to retrieve its dependants sequentially. Two status values are returned by DL/I in the status code field of PCB after executing the call using GU function BALNK - indicates the retrieval was successful GE - indicates the segment occurrence was NOT FOUND
Thank You Polsani Anil Kumar
- Slides: 19