IMS DB GN GU Call IMS Training Class
IMS DB GN & GU Call IMS Training Class 05 www. mainframes-online-training. weebly. com Polsani Anil Kumar
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.
Function Code 01 DLI-FUCN-CODE. 05 GU-FUNC PIC 05 GNP-FUNC PIC 05 GHU-FUNC PIC 05 GHNP-FUNC PIC 05 ISRT-FUNC PIC 05 REPL-FUNC PIC 05 DLET-FUNC PIC X(4) X(4) X(4) VALUE VALUE VALUE 'GU '. 'GNP '. 'GHU '. 'GHNP'. 'ISRT'. 'REPL'. 'DLET'.
Sample PCB-MASK Layout VARIABLE DESCRIPTION 01 ORG-PCB-MASK. 03 ORG-DBD-NAME. Name of the Database being processed 03 ORG-SEG-LEVEL. Specifies current segment level in the DB 03 ORG-STATUS-CODE Contains return code value 03 ORG-PROC-OPT Type of processing the program authorized 03 ORG-SEG-NAME Stores name of the segment just proceeded 03 ORG-KEY-LENGTH Length of the concatenated key 03 ORG-NUM-SENSEGS #SENSEG subordinate to the PCB 03 ORG-KEY-VALUE Key value retrieved
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: 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. Qualified Call: The application program provides an SSA telling IMS what segment to access. For qualified calls, there are two types of SSAs: Unqualified SSA Qualified SSA
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 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.
GN calls without SSA’s –DL/I looks at the current position within the database and retrieves the next segment in hierarchical sequence –Issuing a GN call without SSA as the first call in the program is equivalent to issuing a GN call without SSA. Since both retrieves the first segment in database, the first occurrence of root segment. –Segments are retrieved all the way to the end of the database Call 'CBLTDLI' using GN, PCB-Mask, I-O Area. DL/I Sequential Processing sequence within a database is always Top to Bottom, Left to Right and Front to Back along Twin occurrences
GN call with Unqualified SSA's GN calls with unqualified SSAs lets the sequential retrieval restricted to only a particular segment type, no matter what segments they are dependent upon. For example: - GN PATIENT When issued at the beginning of program execution, position would be established at the beginning of the database; and the call would retrieve the first patient segment 3. Next segment 9. segment 14, segment 17. Finally, the next issue of the same call would cause DL/I to return a GB status code since no more patients segments exist in the Hospital Database.
GN call with Qualified SSA's One strong reason to issue a qualified GN call instead of a GU call is to implement Skip-Sequential Processing In this, segments are always processed in their KEY SEQUENCE If any search value that is lower than the value used in the previous call is provided, DL/I will return a GE status code, which is segment not exists. However, a GU call will go back to the beginning of database to find and retrieve the segment to the program whatever be the search values.
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. An unqualified GU call with retrieve the first occurrence. 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 www. mainframes-online-training. weebly. com Polsani Anil Kumar
- Slides: 23