IMS - DB

page number

1

SESSION 1 SESSION 2 SESSION 3 SESSION 4 SESSION 5 SESSION 6 SESSION 7 SESSION 8 SESSION 9 SESSION 10 SESSION 11

IMS GENERAL CONCEPTS DL/I CONTROL BLOCKS SEGMENT SEARCH ARGUMENTS (SSAs) COBOL BASICS FOR IMS DL/I CALLS COMMAND CODES DL/I CALLS EXERCISE LOGICAL RELATIONSHIP DB RECOVERY/RESTART EFFICIENT PROGRAMMING TIPS COMMON IMS ABENDS

page number

2

SESSION 1 IMS GENERAL CONCEPTS

page number

3

INFORMATION MANAGEMENT SYSTEM DEVELOPED IN 1968 BY IBM DATA LANGUAGE-I (DL/I) WAS DEVELOPED AS A INTERFACE BETWEEN APPLICATION CODE AND DATA IN IMS DATABASE page number 4 .IMS GENERAL CONCEPTS IMS .

Level 1 EACH BOX IN THE HIERARCHY REPRESENTS A SEGMENT ROOT SEGMENT WILL BE ON TOP EACH SEGMENT (EXCEPT ROOT SEGMENT) SEGMENT OCCURRNCES B3 B1 B2 C1 D1 IS DIRECTLY DEPENDENT ON ONLY ONE -.IMS GENERAL CONCEPTS HIERARCHICAL STRUCTURE ROOT SEGMENT (PARENT) FOLLOWS INVERTED TREE STRUCTURE A2 A1 -.Level 2 SEGMENT TWIN SEGMENTS DEPENDENT SEGMENTS page number 5 .

IMS GENERAL CONCEPTS SEGMENT IS THE SMALLEST INFORMATION THAT DL/I CAN FETCH EACH SEGMENT WILL HAVE UNIQUE 8 CHARACTER (MAX) NAME SEGMENTS ARE MADE UP OF 1 OR MORE FIELDS FIELD IS THE SMALLEST UNIT THAT DL/I CAN HANDLE EACH FIELD WILL HAVE MAX 8 CHARACTER NAME SEGMENT TYPE vs SEGMENT OCCURRENCE SEGMENT OCCURRENCE IS A PARTICULAR INSTANCE OF A SEGMENT TYPE page number 6 .

IMS GENERAL CONCEPTS TWO TYPES OF FIELDS KEY FIELDS SEARCH FIELDS KEY FIELD IS USED TO SEQUENCE DATABASE AND IT CAN NOT BE CHANGED BOTH TYPES OF FIELDS CAN BE USED TO SEARCH DATABASE page number 7 .

IMS GENERAL CONCEPTS TYPES OF SEGMENTS ROOT PARENT A SEGMENT WITHOUT PARENT A SEGMENT WITH ONE OR MORE DEPENDENT SEGMENTS DIRECTLY UNDER IT A SEGMENT WHICH IS DIRECTLY DEPENDENT ON ANOTHER SEGMENT ALL SEGMENTS UNDER A PARTICULAR SEGMENT OF THE DATABASE ALL OCCURRENCES (2 OR MORE) OF A SEGMENT TYPE UNDER A PARENT OCCURRENCES OF DIFFERENT SEGMENT TYPES UNDER A PARENT CHILD DEPENDENT TWIN SIBLINGS page number 8 .

IMS GENERAL CONCEPTS Continued ..1 1 2 3 4 5 6 7 8 9 1. EXERCISE . WHICH SEGMENTS ARE DEPENDENT SEGMENTS OF SEGMENT 1? 4. WHICH SEGMENTS ARE CHILD SEGMENTS OF SEGMENT 1? 3. WHICH SEGMENTS ARE DEPENDENT ON SEGMENT 4? 2.. HOW MANY LEVELS? page number 9 .

DATABASE RECORD ONE OCCURRENCE OF A ROOT SEGMENT ALONG WITH ALL ITS DEPENDENT SEGMENTS page number 10 ..IMS GENERAL CONCEPTS Continued ..

IMS GENERAL CONCEPTS Continued ...
EXERCISE-2

HOW MANY DATABASE RECORDS?

page number

11

IMS GENERAL CONCEPTS Continued ...
IMS DATABASE LIMITATIONS
IMS SUPPORTS 15 LEVELS 255 SEGMENTS 1000 FIELDS

NO LIMITATION ON NUMBER OF SEGMENT OCCURRENCES.

page number

12

IMS GENERAL CONCEPTS Continued ...
IMS ENVIRONMENT
DL/I FORMS BRIDGE BETWEEN APPLICATION PROGRAM AND IMS DATABASE DB PCB interface App Prog

DL/I IS DATABASE MANAGER. IT CONSISTS OF IMS PROGRAM MODULES THAT RUN EXTERNAL TO APPLICATION PROGRAM DL/I ALLOWS SEQUENTIAL OR RANDOM PROCESSING OF DATABASE

I/O PCB interface

DL/I

DC

Database

Terminal

page number

13

. IMS ENVIRONMENT MODES OF PROCESSING BATCH DL/I MODE MPP MODE BMP MODE ONLINE BATCH MPP BMP DL/I page number 14 ..IMS GENERAL CONCEPTS Continued .

.IMS GENERAL CONCEPTS Continued . IMS ENVIRONMENT BATCH DL/I TRUE BATCH PROCESSING NO DATA COMMUNICATION SERVICES ARE USED DATABASES ACCESSED MUST BE OFFLINE MPP (MESSAGE PROCESSING PROGRAM) TRUE ONLINE PROCESSING TRANSACTION ARE ENTERED AT TERMINAL AND STORED IN MESSAGE QUEUE DATABASES ACCESSED MUST BE ONLINE page number 15 ..

TRANSACTION ORIENTED: CAN READ & WRITE TO ONLINE MESSAGE QUEUES CAN PROCESS ONLINE FILES AND DATABASES 2.IMS GENERAL CONCEPTS Continued ... IMS ENVIRONMENT BMP (BATCH MESSAGE PROCESSING) TWO TYPES 1. BATCH ORIENTED: CAN ONLY READ MESSAGE QUEUES ACCESS ONLINE DATABASES IN BATCH MODE page number 16 .

SESSION 2 DL/I CONTROL BLOCKS page number 17 .

DL/I CONTROL BLOCKS DATABASE DESCRIPTION (DBD) DEFINES THE LAYOUT OF THE DATABASE DATABASE ADMINISTRATOR DEFINES LAYOUT USING DBDGEN MACRO PROGRAM SPECIFICATION BLOCK (PSB) DEFINES THE PROGRAMS VIEW OF THE DATABASE AND APPLICATION PROGRAMS ACCESS AUTHORITY TO DATABASE DATABASE ADMINISTRATOR / PROGRAMMER DEFINES THIS USING PSBGEN MACRO page number 18 .

ACCESS METHOD SPECIFIES DD NAME TO BE USED IN JCL. DATA BASE DESCRIPTION (DBD) STATEMENTS IN DBD MACRO STATEMENT DBD DATASET SEGM FIELD DESCRIPTION SPECIFIES DATABASE NAME.. PARENT SPECIFIES FIELD NAME..DL/I CONTROL BLOCKS Continued . LENGTH.SEGMENT LENGTH. DISK TYPE SPECIFIES SEGMENT NAME. STARTING POSITION IDENTIFIES A FIELD AS KEY OR SEARCH FIELD page number 19 .

TYPE=C NAME=ORDDATE.BYTES=3..ACCESS=HDAM DD1=VEND.DL/I CONTROL BLOCKS Continued .PARENT=0.START=4..TYPE=C NAME=ITEMSEG.TYPE=C page number 20 .TYPE=C NAME=LOCNSEG.U).DEVICE=3380 NAME=VENSEG.BYTES=5 NAME=(ITEMCODE.SEQ). SAMPLE DBDGEN PRINT DBD DATASET SEGM FIELD SEGM FIELD SEGM FIELD FIELD DBDGEN FINISH END NOGEN NAME=VENDOR.PARENT=VENSEG.BYTES=10 NAME=(VENCODE.SEQ.START=1.BYTES=6.BYTES=10.START=1.START=1.BYTES=9 NAME=(LOCNCODE.PARENT=ITEMSEG.U).BYTES=5.SEQ.

DL/I CONTROL BLOCKS Continued ... DATATYPES USED IN DBDGEN TYPE C P Z H F DESCRIPTION Character (Default) Packed Decimal Zoned Decimal Half Word Binary Full Word Binary COBOL PICTURE X COMP-3 S9 9(4) COMP 9(8) COMP page number 21 .

.. CAN WE DEFINE OVERLAPPING FIELDS? page number 22 .DL/I CONTROL BLOCKS Continued .

DL/I CONTROL BLOCKS Continued . PROGRAM SPECIFICATION BLOCK (PSB) MADE UP OF ONE OR MORE PROGRAM COMMUNICATION BLOCKS (PCBs) DB PCB .DEFINES PROGRAM’S VIEW OF A IMS DATABASE WHENEVER A DATABASE VIEW DEFINED BY THE PCB IS ACCESSED BY A CALL.. THE RESULTS OF CALL ARE PASSED THROUGH THE PCB TO PROGRAM PSB IS GENERATED BY PSBGEN MACRO page number 23 ..

PCB GIVES LOGICAL VIEW OF A DATABASE PORTION OF DATABASE THAT THE PROGRAM PROCESSES IS CALLED APPLICATION DATA STRUCTURE DATABASE A A PCB B C C D E E page number 24 .DL/I CONTROL BLOCKS Continued ...

PROCOPT=LS SENSEG NAME=VENSEG SENSEG NAME=ITEMSEG.KEYLEN=15.DBDNAME=VENDOR.PARENT=VENSEG PSBGEN END • KEYLEN IS THE LENGTH OF CONCATENATED KEY page number 25 . SAMPLE PSBGEN PRINT PCB NOGEN TYPE=DB...DL/I CONTROL BLOCKS Continued .

D) Initial Load Sequential Initial Load Access only Key of segment Used with G to Indicate that Hold is not allowed Path Calls DESCRIPTION page number 26 . PROCOPTS IN PSB DEFINES SECURITY LEVEL FOR THE PROGRAM PROCOPT G I R D A L LS K O P Get or Read Insert Replace Delete All Options (G..DL/I CONTROL BLOCKS Continued .. R. I.

APPLICATION PROGRAM CAN HAVE MULTIPLE VIEWS OF A DATABASE BY USING SEPARATE PCBS FOR A SINGLE DATABASE PSB PCB1 PCB3 PCB2 PCB4 DBD1 DBD2 DBD3 page number 27 ..DL/I CONTROL BLOCKS Continued ..

PROCOPT=R SENSEG NAME=LOCNSEG.DL/I CONTROL BLOCKS Continued .PROCOPT=G SENSEG NAME=ITEMSEG.PROCOPT=A PSBGEN END 1. LIST THE SEGMENTS THAT CANNOT BE UPDATED 3.PARENT=VENSEG. PRINT PCB NOGEN TYPE=DB.PARENT=ITEMSEG. GIVE THE VALID PROCOPT TO BE CODED FOR ADDING AND REPLACING RECORDS IN LOCATION SEGMENT page number 28 .KEYLEN=15 SENSEG NAME=VENSEG..DBDNAME=VENDOR. LIST THE SEGMENTS THAT MAY BE UPDATED USING THIS PSB 2..

PARENT=_____________________ PSBGEN LANG=COBOL.PROCOPT=G SENSEG NAME=_________________.DBDNAME=EMPDB..KEYLEN=16.DL/I CONTROL BLOCKS Continued .. EMPDATA WORKDATA DEPTDATA BENDATA BASED ON THE ABOVE VIEW OF DATABASE FILL IN THE MISSING PIECES OF PCB PCB TYPE=DB.PARENT=_____________________ SENSEG NAME=_________________.PARENT=_____________________ SENSEG NAME=_________________.PARENT=_____________________ SENSEG NAME=_________________.PSBNAME=EMPPSBY END page number 29 .

SESSION 3 SEGMENT SEARCH ARGUMENT page number 30 .

SEGMENT SEARCH ARGUMENT THE SSA IS AN AREA IN WORKING STORAGE USED TO IDENTIFY THE SEGMENT TO WHICH ACCESS IS REQUIRED IT IS AN OPTIONAL DL/I CALL PARAMETER THAT QUALIFIES A CALL BY SPECIFIYING A PARTICULAR SEGMENT TYPE OR OCCURRENCE WHEN SPECIFIED IN A DL/I CALL THE SSA ALWAYS FOLLOWS I/O PARAMETER THERE MAY BE 1 TO 15 SSAs IN A CALL STATEMENT THE SSAs MUST APPEAR IN HIERARCHICAL ORDER BY SEGMENT TYPE THE SSA CONTAINS INFORMATION TO OBTAIN THE REQUIRED SEGMENT. THE INFORMATION COULD BY SEGMENT NAME OR SEGMENT NAME & SEGMENT KEY OR SEGMENT NAME & SEARCH FIELD page number 31 .

Continued . SEGMENT SEARCH ARGUMENT WHAT IS THE SIGNIFICANCE OF MAX 15 SSA? page number 32 ...

. SEGMENT SEARCH ARGUMENT TYPES OF SSAS UNQUALIFIED SEARCHES FOR A SPECIFIC SEGMENT TYPE QUALIFIED SEARCHES FOR A SPECIFIC SEGMENT OCCURRENCE MORE EFFICIENT THAN UNQUALIFIED SSA page number 33 ..Continued .

05 05 SEGMENT-NAME PIC X(8) VALUE ‘HISTORY ‘.Continued . 01 HISTORY-SSA. WORKING-STORAGE-SECTION ………….. Blank in 9th position or ‘*’ in 9th position ‘-‘ in position 10 and a blank in position 11 H I S T O R Y H I S T O R Y * 34 page number ... FILLER PIC X(1) VALUE SPACE. SEGMENT SEARCH ARGUMENT UNQUALIFIED SSA WORKING-STORAGE-SECTION.

PCB-MASK-1..Continued . CALL ‘CBLTDLI’ USING FUNC-CODE. 03 KEY-NAME PIC X(8) VALUE ‘EMPKEY ‘. …. MOVE ‘123456789000’ TO KEY-VALUE.. SEGMENT SEARCH ARGUMENT QUALIFIED SSA WORKING-STORAGE-SECTION. 03 SEGMENT-NAME PIC X(8) VALUE ‘EMPLOYEE’ 03 COMMAND-CODE PIC X(2) VALUE ‘*-’. 03 KEY-VALUE PIC X(12) . IO-AREA. 01 SSA-EMPLOYEE... WORKING-STORAGE-SECTION …………. page number 35 . PROCEDURE DIVISION. 03 BEGIN-QUALIFY PIC X(1) VALUE ‘(‘. SSA-EMPLOYEE. 03 END-QUALIFY PIC X(1) VALUE ‘)‘. 03 OPERATOR PIC X(2) VALUE ‘ =‘.

‘ =‘ ‘NE’. ‘<=‘. ‘= ‘.. ‘¬=‘. ‘ >’ ‘GE’.Continued . SEGMENT SEARCH ARGUMENT OPERATORS USED IN QUALIFIED SSA OPERATOR Equal to Not Equal to Less than Less than or Equal to Greater than Greater than or Equal to SYMBOLS ‘EQ’. ‘=>’ page number 36 . ‘=¬’ ‘LT’. ‘>=‘. ‘ <‘ ‘LE’. ‘< ‘.. ‘> ‘. ‘=<‘ ‘GT’.

Continued .. SEGMENT SEARCH ARGUMENT COMMAND CODES COMMAND CODES INCREASE THE FUNCTIONALITY OF IMS CALLS COMMAND CODES ARE DESIGNATED BY AN ASTERISK ‘*’ FOLLOWED BY CHARACTERS NOTE: Detailed description of Command codes will be covered in Session “COMMAND CODES” page number 37 ..

SESSION 4 COBOL BASICS FOR IMS page number 38 .

COBOL BASICS FOR IMS DATA DIVISION IN A COBOL-IMS PROGRAM. THE FIRST SECTION TO CONTAIN ANY IMS RELATED COMPONENTS IS THE WORKING STORAGE SECTION IDENTIFICATION DIVISION ENVIRONMENT DIVISION DATA DIVISION FILE SECTION WORKING STORAGE SECTION LINKAGE SECTION PROCEDURE DIVISION FUNCTION CODES I/O AREA SEGMENT SEARCH ARGUMENTS PCB MASKS page number 39 .

FUNCTION CODES A FUNCTION CODE IS A 4 BYTE CODE TO TELL DL/I WHAT KIND OF CALL THE PROGRAM IS MAKING SOME VALID FUNCTION CODES ARE GU GET UNIQUE GN GET NEXT GNP GET NEXT WITHIN PARENT GHU GET HOLD UNIQUE GHN GET HOLD NEXT GHNP GET HOLD NEXT WITHIN PARENT DLET DELETE REPL REPLACE ISRT INSERT XRST EXTENDED RESTART CHKP CHECKPOINT page number 40 ...COBOL BASICS FOR IMS Continued .

THE I/O AREA MUST BE LARGE ENOUGH TO HOLD THE LARGEST CONCATENATION OF THESE SEGMENTS page number 41 ..COBOL BASICS FOR IMS Continued . INPUT/OUTPUT AREA IS A STANDARD RECORD DESCRIPTION IN THE WORKING STORAGE SECTION WHICH HOLDS DATABASE SEGMENTS FOR MANIPULATION IS USED BY DL/I TO PASS SEGMENTS TO THE PROGRAM CAN BE USED BY PROGRAMMER TO ADD OR REPLACE SEGMENT DATA MUST BE EQUAL TO OR GREATER THAN THE LENGTH OF THE LONGEST SEGMENT TO BE USED BY THE PROGRAM IN CASES WHERE MULTIPLE SEGMENTS OF A HIERARCHY ARE UPDATED OR RETRIEVED..

PIC S9(5) COMP. PIC S9(5) COMP. PIC X(4). <= length depends on segment key page number 42 . PIC X(2). PIC S9(5) COMP.COBOL BASICS FOR IMS Continued ... 03 DBD-NAME 03 SEG-LEVEL 03 STATUS-CODE 03 PROC-OPTIONS 03 IMS-RESERVED 03 SEG-NAME 03 KEY-LEN 03 NUM-SENS-SEGS 03 KEY-FEEDBACK PIC X(8). THE PCB MASK USED IN LINKAGE SECTION LINKAGE SECTION 01 DB-PCB-1. PIC X(2). PIC X(??). PIC X(8).

COBOL BASICS FOR IMS Continued ... THE PCB MASK THERE SHOULD BE ATLEAST ONE PCB FOR EACH DATABASE USED STATUS CODE OF PCB MASK EXPLAINS WHETHER A CALL IS SUCCESSFUL OR NOT THE SEQUENCE IN WHICH PCB MASKS ARE DEFINED IN LINKAGE SECTION NEED NOT BE SAME AS THAT IN PSBGEN MACRO page number 43 .

SSA-1. :::::::::: :::::::::: GOBACK. page number 44 PSB Macro <= Optional . …. DB-PCB-2. DB-PCB-MASK.. SSA-3. <= Sequence should match that of :::::::::::: :::::::::::: CALL ‘CBLTDLI’ USING WS-PARM-COUNT.. WS-FUNCTION-CODE. SSA-2. DIVISION ENTRY ‘DLITCBL’ USING DB-PCB-1. PROCEDURE DIVISION PROCEDURE DIVISION.COBOL BASICS FOR IMS Continued . IO-AREA.

RUN JCL EXECUTES THE BATCH PROCESSOR DFSRRC00 AND PASSES THE APPLICATION PROGRAM NAME AND PSBNAME AS PARAMETERS ENTRY DLITCBL PASSES THE PCB ADDRESS TO THE PROGRAM RUN JCL PROGRAM NAME PSB NAME DL/I IMS DATABASE CBLTDLI ACCEPTS PARAMETERS LIKE FUNCTION CODE. “STOP RUN” SHOULD NEVER BE USED AS IT WILL NOT FREE RESOURCES page number 45 . I/O AREA AND SSA TO DO THE NECESSARY DATABASE OPERATIONS AND RETURNS DATA AND STATUS CODES DESCRIBING THE SUCCESS OF THE CALL DLITCBL CBLTDLI GOBACK APPLICATION PROGRAM GOBACK IN THE COBOL PROGRAM TAKES THE CONTROL BACKTO DL/I WHICH PERFORMS IMS FILES CLOSING AND TERMINATES THE BATCH STEP...COBOL BASICS FOR IMS Continued .

SESSION 5 DL/I CALLS page number 46 .

GET HOLD NEXT GHNP .GET NEXT WITHIN PARENT WHEN A RETRIEVAL IS DONE WITH AN INTENT TO UPDATE OR DELETE RECORDS. THE ABOVE FUNCTION CODES WILL BE PREFIXED WITH ‘HOLD’ GHU GHN .GET HOLD UNIQUE .DL/I CALLS DL/I RETRIEVAL CALLS ONE OF THE FOLLOWING FUNCTIONS WILL BE USED IN A RETRIEVAL DL/I CALL GU GN GNP .GET NEXT .GET UNIQUE .GET HOLD NEXT WITHIN PARENT page number 47 .

.. DL/I CALLS GET UNIQUE CALL ‘CBLTDLI’ USING ‘GU ‘.Continued . PCB-MASK. SEGMENT-IO-AREA SEGMENTA*-(AKEY=1) SEGMENTB*-(BKEY=2) SEGMENTD*-(DKEY=6) AFTER THE CALL SEGMENTD WITH DKEY=6 WILL BE IN SEGMENT-IO-AREA 1 AKEY EKEY 7 2 11 BKEY 8 3 4 6 5 9 10 CKEY DKEY FKEY EXERCISE: WRITE A GU TO RETRIEVE FKEY=10 page number 48 .

DL/I CALLS WHAT WILL BE THE OUTPUT OF A GU CALL WITH NO SSA? page number 49 ...Continued .

DL/I CALLS GET NEXT RETREIVAL SEQUENCE TOP TO BOTTOM FRONT TO BACK LEFT TO RIGHT 7 2 11 1 AKEY EKEY BKEY GA 8 3 4 GK 6 5 9 10 CKEY DKEY FKEY page number 50 ...Continued .

.. SEGMENTA*-(AKEY=1) SEGMENTE*-(EKEY=8) AFTER THE CALL SEGMENTE WITH EKEY=8 WILL BE IN PROGRAM I/O AREA AKEY 1 7 2 11 EKEY BKEY 6 5 8 3 4 9 10 CKEY DKEY FKEY EXERCISE: WHAT WILL BE THE RESULTS OF FOUR CONSEQUETIVE GNs AFTER EKEY=8 IS RETRIEVED page number 51 .Continued . PCB-MASK. DL/I CALLS CALL ‘CBLTDLI’ USING ‘GN ‘. SEG-IO-AREA.

LS-PCB-MASK.. SEGMENT-IO-AREA. DL/I CALLS GET NEXT WITHIN PARENT CALL ‘CBLTDLI’ USING ‘GN ’.Continued .. SEGMENTA*-(AKEY=1) SEGMENTB*-(BKEY=2) CALL ‘CBLTDLI’ USING ‘GNP ‘. SEGMENT-IO-AREA AFTER THE CALL SEGMENTC WITH CKEY=3 WILL BE IN SEGMENT-IO-AREA 1 AKEY 7 2 11 EKEY BKEY 6 5 8 3 4 9 10 CKEY DKEY FKEY page number 52 . LS-PCB-MASK.

.Continued .. DL/I CALLS WHAT WILL BE THE OUTPUT IF GNP IS DONE 4 MORE TIMES IN PREVIOUS EXAMPLE? page number 53 .

Continued . SEGMENTA*D(AKEY=1) SEGMENTF*-(FKEY=10) WHAT WILL BE THE RESULT AFTER SUCCESSFUL COMPLETION OF THE ABOVE CALL? 1 7 2 11 EKEY BKEY 6 5 8 3 4 9 10 CKEY DKEY FKEY page number 54 .. LS-PCB-MASK. WS-SEG-IO-AREA. DL/I CALLS PATH CALLS EXERCISE CALL ‘CBLTDLI’ USING ‘GN ‘..

DL/I CALLS GET HOLD CALLS (GHU/GHN/GHNP) FUNCTIONS IDENTICAL TO GU/GN/GNP INDICATES THE REQUESTED SEGMENT(S) MAY BE DELETED OR REPLACED FORCING IMS TO PUT A LOCK ON THESE SEGMENTS WHICH WILL BE RELEASED ONLY AFTER ANOTHER CALL BY SAME PCB THIS ENSURES DATA INTEGRITY page number 55 ...Continued .

GHNP) NO INTERVENING CALLS BETWEEN GET HOLD CALL AND REPLACE/DELETE CALLS MULTIPLE REPLACE ALLOWED AFTER GET HOLD page number 56 . DL/I CALLS DELETE/REPLACE CALLS MUST HAVE BEEN OBTAINED WITH A GET HOLD CALL (GHU. GHN.Continued ...

Continued . WS-SEGMENT-IO-AREA SEGMENTA*-(AKEY=1) SEGMENTB*-(BKEY=2) CALL ‘CBLTDLI’ USING ‘DLET’. LS-PCB-MASK 1 7 2 11 EKEY BKEY 6 5 8 3 4 9 10 CKEY DKEY WHAT WILL BE THE RESULT IF THE FIRST GHU CALL IS SEGMENTA*D(AKEY=1)? page number 57 .. DL/I CALLS DELETE CALL CALL ‘CBLTDLI’ USING ‘GHU ‘.. LS-PCB-MASK.

TO REPLACE PATH OF SEGMENTS N ..TO EXCLUDE SEGMENTS FROM PATH STATUS CODES DA . DL/I CALLS REPLACE (REPL) UPDATE CONTENTS OF A SEGMENT KEY FIELD MAY NOT BE ALTERED SSAs ARE NOT USED NORMALLY COMMAND CODES D ..REPLACE RULE VIOLATION page number 58 .TRYING TO CHANGE KEY DJ .NO PRECEDING GET HOLD CALL RX .Continued .

WS-IO-AREA.Continued . WS-IO-AREA WILL RESULT IN UPDATE OF SEGMENTC 1 7 2 11 EKEY BKEY 6 5 8 3 4 9 10 CKEY DKEY FKEY 59 page number . LS-PCB-MASK. DL/I CALLS CALL ‘CBLTDLI’ USING ‘GHU ‘.. LS-PCB-MASK.. SEGMENTA*-(AKEY=1) SEGMENTB*-(BKEY=2) SEGMENTC*-(CKEY=3) Change contents of WS-IO-AREA CALL ‘CBLTDLI USING ‘REPL’.

DL/I CALLS INSERT (ISRT) TWO MODES OF INSERT LOAD MODE UPDATE MODE LOAD MODE: MODE FOR LOAD MODE PROCOPT = L or LS MUST BE SPECIFIED IN PSB PROCOPT=L LOADS DATABASE BUT NOT NECESSARILY IN SEQUENTIAL ORDER ...ADD TO EXISTING DATABASE page number 60 .FOR INITIAL LOADING OF DATABASE .Continued .

OVERRIDES INSERT RULE .INSERT PATH OF SEGMENTS page number 61 ..Continued .. DL/I CALLS INSERT (ISRT) UPDATE MODE: MODE FOR UPDATE MODE PROCOPT=I or IS MUST BE SPECIFIED IN PSB PROCOPT=I INSERTS SEGMENTS IN SEQ OR RANDOM ORDER PROCOPT=IS ADDS NEW SEGMENTS ONLY IN ASCENDING ORDER COMMAND CODES “F” OR “L” “D” .

Continued .. SEGMENTA*-(AKEY=1) SEGMENTE AFTER THE CALL SEGMENTE WITH EKEY=99 IS INSERTED 1 99 7 2 11 EKEY BKEY 6 5 8 3 4 9 10 CKEY DKEY FKEY 62 page number .. LS-PCB-MASK. WS-SEGMENT-IO-AREA. DL/I CALLS MOVE DATA FOR SEGMENTE INTO WS-SEGMENT-IO-AREA WITH EKEY=99 CALL ‘CBLTDLI’ USING ‘ISRT’.

GNP page number 63 .Continued .. DL/I CALLS SOME COMMON STATUS CODES STATUS CODE SPACES AC AI DESCRIPTION SUCCESSFUL CALL CALL HAS SSA WITH A HIERARCHICAL ERROR ERROR WHILE OPENING DATABASE.. COMMON CAUSE IS LOADING A DATABASE WHICH IS NOT EMPTY OR DO OTHER THAN LOAD PROCESSING ON EMPTY DATABASE CALL SPECIFIES AN INVALID SSA FIELD NAMED IN A QUALIFIED SSA IS NOT CORRECT SEQUENCE FIELD IS CHANGED CALL IS NOT PRECEDED BY A SUCCESSFUL GET HOLD CALL A HIGHER LEVEL SEGMENT IS RETRIEVED IN SEQUENTIAL PROCESSING CALL TYPES ALL CALLS ALL GET CALLS ISRT ALL CALLS AJ AK DA DJ GA ALL CALLS ALL GET CALLS ISRT REPL DLET REPL GN.

. BUT AT THE SAME LEVEL IS RETRIEVED DURING SEQUENTIAL PROCESSING PROPER PARENTAGE IS NOT IN EFFECT DUPLICATE INSERT CALL TYPES GN ALL GET CALLS ISRT GN. GNP GNP ISRT page number 64 . DL/I CALLS SOME COMMON STATUS CODES STATUS CODE GB GE GK GP II DESCRIPTION END OF DATA BASE WAS REACHED DURING SEQUENTIAL RETRIEVAL SPECIFIED SEGMENT NOT FOUND A SEGMENT OF DIFFERENT TYPE.Continued ..

SESSION 6 COMMAND CODES page number 65 .

COMMAND CODES ONE OR MORE COMMAND CODES CAN BE USED IN SSA EACH COMMAND CODE IS REPRESENTED BY A SINGLE CHARACTER FOLLOWING AN ASTERISK AFTER SEGMENT NAME H I S T O R Y * - DL/I CONSIDERS ALL CHARACTERS FOLLOWING ‘*’ TO BE COMMAND CODES TILL IT ENCOUNTERS A BLANK OR ‘(‘ RESULTS IN MINIMIZING THE NUMBER OF CALLS AND HENCE IMPROVE PROGRAM EFFICIENCY page number 66 .

Continued .. COMMAND CODES SOME COMMAND CODES COMMAND CODE D F L U V N C P RETRIEVE A PATH DESCRIPTION FIRST OCCURRENCE OF SEGMENT TYPE LAST OCCURRENCE OF SEGMENT TYPE MAINTAIN CURRENT POSITION AT THIS LEVEL MAINTAIN CURRENT POSITION AT THIS AND HIGHER LEVELS DO NOT REPLACE THIS SEGMENT USE A CONCATENATED KEY ESTABLISH PARENTAGE AT THIS LEVEL NULL/IGNORE page number 67 ..

Continued .. COMMAND CODES COMMAND CODE “D” REQUESTS DL/I TO USE PATH CALLS ALLOWS ENTIRE PATH IN SEGMENT HIERARCHY TO BE RETRIEVED IN ONE SINGLE CALL FOR PROGRAMS USING PATH CALLS PROCOPT IN PSB SHOULD HAVE “P” AS ONE OF THE VALUES DL/I DOES NOT RETRIEVE SEGMENTS IF THE CORRESPONDING SSA DOES NOT HAVE PATH COMMAND CODE “D” page number 68 ..

.Continued .. “D” COMMAND CODE IS PROPAGATED TO ALL SPECIFIED SEGMENTS AUTOMATICALLY I/O AREA USED SHOULD BE BIG ENOUGH TO ACCOMMODATE ALL SEGMENTS IN PATH page number 69 . COMMAND CODES COMMAND CODE “D” SEGMENT IN THE LAST SSA WILL ALWAYS BE RETRIEVED EVEN IF SSA DOES NOT HAVE COMMAND CODE “D” FOR ISRT CALLS COMMAND CODE “D” DESIGNATES THE FIRST SEGMENT TO BE INSERTED FOR ISRT CALLS SSAS FOR LOWER LEVEL SEGMENTS NEED NOT HAVE “D” COMMAND CODE.

#2 & #5 WILL BE RETURNED IN I/O AREA 1 AKEY 7 2 11 EKEY BKEY 6 5 8 3 4 9 10 CKEY DKEY FKEY page number 70 . COMMAND CODES PATH CALLS EXAMPLE CALL ‘CBLTDLI’ USING ‘GU ‘. LS-PCB-MASK.. WS-SEG-IO-AREA.Continued . SEGMENTA*D(AKEY=1) SEGMENTB*D(BKEY=2) SEGMENTD*-(DKEY=5) AFTER THE CALL SEGMENTS #1..

SEGMENTB*F 1 SEGMENTA 4 2 3 SEGMENTB SEGMENTC page number 71 . COMMAND CODES COMMAND CODE “F” CALL PROCESSES FIRST OCCURRENCE OF THE SEGMENT TYPE •EXAMPLE: SEGMENT 2 CAN BE RETRIEVED AFTER SEGMENT 4 BY USING CALL ‘CBLTDLI’ USING ‘GNP ‘ LS-PCB-MASK...Continued . WS-SEG-IO-AREA.

. SEGMENTC*L 1 SEGMENTA 4 2 3 SEGMENTB SEGMENTC page number 72 .Continued . WS-SEG-IO-AREA. COMMAND CODES COMMAND CODE “L” CALL PROCESSES LAST OCCURRENCE OF THE SEGMENT TYPE •EXAMPLE: SEGMENT 4 CAN BE RETRIEVED AFTER SEGMENT 2 BY USING CALL ‘CBLTDLI’ USING ‘GNP ‘ LS-PCB-MASK..

. COMMAND CODES COMMAND CODE “N” USED IN REPL CALLS FOLLOWING PATH CALLS IF ANY SEGMENT RETRIEVED DURING PATH CALL NEED NOT BE REPLACED COMMAND CODE “N” IS USED IN SSA OF THAT SEGMENT page number 73 ..Continued .

Continued .. WS-IO-AREA SEGMENTA*P SEGMENTC WILL RETRIEVE SEGMENTC TO I/O AREA BUT PARENTAGE WILL BE SET TO SEGMENTA 1 SEGMENTA 2 3 SEGMENTB page number SEGMENTC 74 .. COMMAND CODES COMMAND CODE “P” IS USED TO SET PARENTAGE TO A SPECIFIC SEGMENT IN THE HIERARCHY USED IN SSAS EXAMPLE: CALL ‘CBLTDLI’ USING ‘GU ‘ LS-PCB-MASK.

SESSION 7 DL/I CALL EXERCISE page number 75 .

.. DL/I CALL EXERCISE COURSE COURSE# TITLE DESCRIPN PREREQ COURSE# TITLE OFFERING DATE LOCATION FORMAT TEACHER EMPNUM NAME STUDENT EMPNUM NAME GRADE page number 76 .Continued .

Continued ... DL/I CALL EXERCISE GIVE SYNTAX OF DL/I CALLS FOR THE FOLLOWING SCENARIOS 1. GET THE FIRST OFFERING OCCURRENCE WHERE THE LOCATION IS “CHENNAI”

2. GET ALL STUDENT OCCURENCES FOR THE OFFERING FOUND IN 1

3. GET ONLY STUDENT OCCURENCES WITH GRADE OF “A”

4. SEQUENTIAL READ OF ALL SEGMENTS IN THE DATABASE

page number

77

Continued ... DL/I CALL EXERCISE 5. GET ALL STUDENTS WITH GRADE OF “A” IN COURSE “IMS”

6. ADD A STUDENT OCCURRENCE FOR THE COURSE “IMS” OFFERED ON DATE “3/26/02”

7. DELETE THE OFFERING OF COURSE “XYZ” ON 26 March, 2002

8. CHANGE THE LOCATION OF COURSE “IMS” OFFERED ON “3/26/02” TO “MUMBAI”

page number

78

Continued ... DL/I CALL EXERCISE 9. GET THE FIRST OFFERING OCCURRENCE WHERE THE LOCATION IS “CHENNAI”, TOGETHER WITH ITS PARENT COURSE OCCURRENCE

10. INSERT A NEW COURSE “ABC” TOGETHER WITH AN OFFERING AT CHENNAI ON 26 March 2002, FOR WHICH TEACHER IS EMPLOYEE NUMBER 12345

11. GET THE TEACHER OF THE FIRST OFFERING ATTENDED BY STUDENT 222222

page number

79

SESSION 8 LOGICAL RELATIONSHIPS page number 80 .

ONE THAT DOES NOT EXIST IN PHYSICAL STORAGE BUT CAN BE PROCESSED BY APPLICATION PROGRAMS AS THOUGH IT EXISTS THREE TYPES OF LOGICAL RELATIONSHIPS UNIDIRECTIONAL LOGICAL RELATIONSHIP BIDIRECTIONAL PHYSICALLY PAIRED LOGICAL RELATIONSHIP BIDIRECTIONAL VIRTUALLY PAIRED LOGICAL RELATIONSHIP page number 81 .LOGICAL RELATIONSHIPS RELATIONSHIP BETWEEN TWO SEGMENTS IN TWO PHYSICALLY SEPARATE DATABASES CAN ALSO CONNECT TWO SEGMENTS WITHIN THE SAME DATABASE ALLOWS APPLICATION TO HAVE DIRECT ACCESS FROM A SEGMENT IN ONE PHYSICAL DATABASE TO A LOWER LEVEL SEGMENT IN ANOTHER PHYSICAL DATABASE RESULTS IN A NEW HIERARCHY.

LOGICAL Continued .. RELATIONSHIPS Logical Parent PART Database PART Logical Relationship STOCK DETAIL SHIPMENT of DETAIL ORDER ORDER Database Physical Parent of DETAIL Logical Children of PART Physical Children of ORDER page number 82 ..

. RELATIONSHIPS PART /ORDER Logical Database PART ORDER/PART Logical Database ORDER STOCK DETAIL ORDER DETAIL PART SHIPMENT SHIPMENT STOCK page number 83 ..LOGICAL Continued .

SESSION 9 DB RECOVERY / RESTART page number 84 .

DATABASE RECOVERY WHY? TO RESTORE A DATABASE AFTER ITS PARTIAL DESTRUCTION WHEN? A DLI BATCH UPDATE JOB FAILS AFTER MAKING AT LEAST ONE DATABASE UPDATE A FAILURE HAS OCCURRED ON A PHYSICAL DASD DEVICE A FAILURE HAS OCCURRED IN A DATABASE RECOVERY UTILITY A FAILURE OF DYNAMIC BACKOUT OR BATCH BACKOUT UTILITY HAS OCCURRED AN IMS ONLINE SYSTEM FAILURE AND EMERGENCY RESTART HAS NOT BEEN COMPLETED page number 85 .

DATABASE RECOVERY HOW? ONLINE RECOVERY PROCESS IMS DOES DYNAMIC BACKOUT USING THE LOG INFORMATION FOR DL/I PROGRAMS FOR BMP PROGRAMS UPDATES ARE AUTOMATICALLY BACKED OUT TO THE LAST CHECKPOINT BATCH RECOVERY PROCESS FORWARD RECOVERY BACKWARD RECOVERY / BATCH BACK OUT page number 86 ..Continued ..

. USING A PRIOR DATABASE IMAGE COPY AND THE ACCUMULATED CHANGES FROM DL/I LOG TAPES DFSBBO00: DFSBBO00 DATABASE BACK OUT UTILITY FOR REMOVAL OF CHANGES MADE TO DATABASES BY A SPECIFIC APPLICATION PROGRAM page number 87 . DATABASE RECOVERY UTILITIES FOR RECOVERY DFSUDMP0: DFSUDMP0 DATABASE IMAGE COPY UTILITY FOR CREATION OF IMAGE COPIES OF DATABASES DFSUCUM0: DFSUCUM0 DATABASE CHANGE ACCUMULATION UTILITY FOR ACCUMULATION OF DATABASE CHANGES FROM DL/I LOG TAPES SINCE THE LAST COMPLETE IMAGE COPY DFSURDB0: DFSURDB0 DATABASE RECOVERY UTILITY FOR RESTORATION OF THE DATABASE..Continued .

Continued . DATABASE RECOVERY DATABASE RECOVERY CONTROL (DBRC) DBRC INCLUDES THE IMS FUNCTIONS WHICH PROVIDE IMS SYSTEM AND DATABASE INTEGRITY AND RESTART CAPABILITY.. DBRC RECORDS INFO IN 3 RECON VSAM DATASETS RECON CONTAINS FOLLOWING INFORMATION LOG DATA SET INFORMATION DATABASE DATA SET INFORMATION ALLOCATION OF A DATABASE UPDATE OF A DATABASE IMAGE COPY OF A DATABASE ABEND OF A SUBSYSTEM RECOVERY OF A DATABASE REORGANIZATION OF A DATABASE DBRC AUTHORIZES OR REFUSES TO AUTHORIZE THE DATABASES DEPENDING ON THE CURRENT AUTHORIZATIONS AND THE ACCESS INTENT OF THE SUBSYSTEM. page number 88 ..

. DATABASE RECOVERY FORWARD RECOVERY RESTORE MOST RECENT IMAGE COPY DATASET CHANGES MADE TO DATABASE SINCE THE LAST IMAGE COPY ARE APPLIED ON THE RESTORED DATABASE BY USING CHANGE ACCUMULATION DATASETS LOG DATASETS page number 89 ..Continued .

DATABASE RECOVERY BACKWARD RECOVERY USES BATCH BACKOUT UTILITY TO DO A FULL BACKOUT OR BACKOUT TO ANY PRIOR CHECKPOINT PSB USED IS SAME AS PSB OF THE PROGRAM WHOSE EFFECTS HAVE TO BE BACKED OUT INPUTS LOG DATASETS DATABASES WHOSE UPDATES ARE TO BACKED OUT CHECKPOINT ID WARNING: DO NOT USE CHECKPOINT ID WHILE BACKING OUT BMP. IT TAKES BY DEFAULT THE LAST CHECKPOINT ISSUED.Continued ... OUTPUTS BACKED OUT DATABASES LOG DATASETS page number 90 .

DATABASE RECOVERY HOW DO YOU BACK OUT A NORMALLY TERMINATED PROGRAM? BY GIVING DBRC=C IN THE JCL SHOWN BELOW //STEP1 // // // // // //* EXEC PGM=DFSRRC00..&IRLMNM. &DBRC. PARM=(DLI.. REGION=5632K.&BKO) page number 91 .&IRLM.&FMTO.&SWAP..&PSB.Continued .&CKPTID..&MON..&PRLD. &SRCH. &SPIE&TEST&EXCPVR&RST.&MBR.

IO-AREA •SYMBOLIC CHECKPOINT –STORES CRITICAL DATA APART FROM CHECKPOINT ID –MUST USE XRST FOR RESTARTING –SYNTAX: CALL ‘CBLTDLI’ USING WS-CHKP.. IO-AREA-LEN. IO-AREA.Continued . IO-AREA1… page number 92 . IO-PCB. IO-AREA-LEN1. DATABASE RECOVERY CHECKPOINT CALL (CHKP) CHECKPOINT RESTART IS USED DURING BACKWARD RECOVERY CHECKPOINT COMMITS PROGRAMS UPDATES TO THE DATABASE AND LOGS THE UPDATES TWO TYPES OF CHECKPOINTS •BASIC CHECKPOINT –STORES JUST CHECKPINT ID ( 8 BYTES STORED IN IO-AREA) –SYNTAX: CALL ‘CBLTDLI’ USING WS-CHKP.. IO-PCB.

IO-AREA-LEN1. IO-AREA.Continued . IO-PCB.. DATABASE RECOVERY RESTART CALL(XRST) USED TO RESTART A PROGRAM AFTER ABNORMAL TERMINATION RESTART FROM SPECIFIC CHECKPOINT ID TIME/DATESTAMP LAST CHECKPOINT (‘LAST’) .BMPs ONLY MUST BE THE FIRST CALL IN THE PROGRAM SYNTAX: CALL ‘CBLTDLI’ USING WS-XRST. IO-AREA-LEN.. IO-AREA1… page number 93 .

.KEEP..KEEP) FOR INITIAL RUN AND DISP=(OLD.KEEP) FOR RESTARTS page number 94 . DATABASE RECOVERY FACTORS TO BE CONSIDERED FOR CHKP & XRST CALLS ALL FILES (INCLUDING SYSIN.Continued .KEEP. SYSOUT) USED BY PROGRAM SHOULD BE DL/I (GSAM) DATABASES OTHERWISE THERE WILL BE DUPLICATE DATA OR LOSS OF DATA GSAM OUTPUT FILES SHOULD USE DISP=(NEW.

SESSION 10 EFFICIENT PROGRAMMING TIPS page number 95 .

PROGRAMMING TIPS INSTEAD OF USING GET CALL PRECEDING A ISRT CALL USE ISRT WITH APPROPRIATE SSA USE QUALIFIED SSAS WHEREVER POSSIBLE IMPLIED SSAS SHOULD BE AVOIDED EVENTHOUGH DL/I CONSTRUCTS MISSING SSAS MINIMIZE THE NUMBER OF DL/I CALLS BY USING COMMAND CODES USE SEARCH FIELDS IN DL/I CALLS INSTEAD OF USING IF STATEMENTS IN COBOL PROGRAM page number 96 .

PROGRAMMING TIPS TRY USING SECONDARY INDICES DESIGN YOUR PROGRAM TO RUN IN BOTH BMP AND BATCH MODE USE CHECKPOINT/RESTART THERE IS ONLY A SMALL PERFORMANCE DIFFERENCE BETWEEN THE GET AND GET HOLD CALLS.Continued .. SO USE GET HOLD CALLS WHENEVER THERE IS A CHANCE ( > 5%) OF SEGMENT UPDATE/DELETE IT IS GOOD PRACTICE TO PROGRAM FOR EASY ADJUSTMENT OF CHECKPOINT FREQUENCY page number 97 ..

SESSION 11 COMMON IMS ABENDS page number 98 .

SOLUTION •BRING DOWN THE DATABASE USING /DBR DB DATABASE NAME •WAIT TILL CONTENDING JOB COMPLETES AND RESTART THE JOB page number 99 . USUALLY OCCURS WHEN DATABASE IS UP IN ONLINE OR DATABASE IS USED IN UPDATE MODE BY ANOTHER PROGRAM.COMMON IMS ABENDS U0047 DESCRIPTION ONE OF THE DBPCBS IN THE PSB FAILED TO OBTAIN THE DATABASE AUTHORIZATION THROUGH DBRC.

COMMON IMS ABENDS U0456 DESCRIPTION A DL/I BATCH REGION. BMP PROGRAM COULD NOT BE INITIATED BECAUSE THE PSB HAS BEEN STOPPED OR LOCKED BY A COMMAND OR A PRIOR PROGRAM FAILURE SOLUTION •ANALYZE WHY THE PSB IS LOCKED OR STOPPED. RESTART THE JOB AFTER THE PSB HAS BEEN UNLOCKED TO UNLOCK PSB FOR A BMP PROGRAM USE /START PROGRAM psbname COMMAND page number 100 .

COMMON IMS ABENDS U0476 DESCRIPTION A DL/I CALL DOES NOT INCLUDE A VALID PCB ADDRESS PROBABLE CAUSES • PSB LANGUAGE TYPE SPECIFIED IS NOT SAME AS THAT OF APPLICATION PROGRAM • COBOL MAIN PROGRAM ENTERED AT PROCEDURE DIVISION INSTEAD OF DLITCBL BECAUSE ENTRY DLITCBL NOT INCLUDED IN LKED • WRONG PCB WITH FEWER PCBS THAN EXPECTED IS USED page number 101 .

RECOVER THE DATABASE.COMMON IMS ABENDS U0852 DESCRIPTION THE SEGMENT CODE RETURNED IS NOT VALID FOR THE DATABASE SOLUTION ANALYZE THE DATABASE. IF THERE IS AN INVALID POINTER. page number 102 .

COMMON IMS ABENDS U3303 DESCRIPTION APPLICATION PROGRAM TRIED TO USE A DATABASE THAT WAS NOT AVAILABLE FOR ACCESS AND/OR UPDATE. DFS3303I MESSAGE ACCOMPANIES THIS ABEND SOLUTION CHECK THE STATUS OF DATABASE GIVEN IN DFS3303I MESSAGE USING /DISPLAY DB database name IF DATABASE IS DOWN START THE DATABASE USING THE COMMAND /START DB database name page number 103 .

Sign up to vote on this title
UsefulNot useful