IMS - DB 1 SESSION 1 IMS GENERAL CONCEPTS SESSION 2 DL/I CONTROL BLOCKS SESSION 3 SEGMENT SEARCH ARGUMENTS (SSAs) SESSION 4 COBOL BASICS FOR IMS SESSION 5 DL/I CALLS SESSION 6 COMMAND CODES SESSION 7 DL/I CALLS EXERCISE SESSION 8 DATABASE ACCESS METHODS SESSION 9 MULTIPLE PROCESSING SESSION 10 SECONDARY INDEXING SESSION 11 LOGICAL RELATIONSHIP SESSION 12 DB RECOVERY/RESTART SESSION 13 EFFICIENT PROGRAMMING TIPS SESSION 14 COMMON IMS ABENDS 2 SESSION 1 IMS GENERAL CONCEPTS 3 IMS - 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 4 Continued ... HIERARCHICAL STRUCTURE ROOT SEGMENT (PARENT) FOLLOWS INVERTED TREE STRUCTURE A2 -- Level 1 A1 EACH BOX IN THE HIERARCHY REPRESENTS A SEGMENT SEGMENT OCCURRNCES ROOT SEGMENT WILL BE ON TOP EACH SEGMENT (EXCEPT ROOT SEGMENT) B3 B1 B2 TWIN SEGMENTS IS DIRECTLY DEPENDENT ON ONLY ONE C1 D1 -- Level 2 SEGMENT DEPENDENT SEGMENTS 5 Continued ... 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 6 Continued ... 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 7 IMS GENERAL CONCEPTS Continued ... TYPES OF SEGMENTS ROOT A SEGMENT WITHOUT PARENT A SEGMENT WITH ONE OR MORE DEPENDENT SEGMENTS PARENT DIRECTLY UNDER IT A SEGMENT WHICH IS DIRECTLY DEPENDENT ON ANOTHER CHILD DEPENDENT TWIN SIBLINGS 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 8 Continued ... EXERCISE - 1 1 2 5 6 3 7 4 8 9 1. WHICH SEGMENTS ARE DEPENDENT ON SEGMENT 4? 2. WHICH SEGMENTS ARE CHILD SEGMENTS OF SEGMENT 1? 3. WHICH SEGMENTS ARE DEPENDENT SEGMENTS OF SEGMENT 1? 4. HOW MANY LEVELS? 9 Continued ... DATABASE RECORD ONE OCCURRENCE OF A ROOT SEGMENT ALONG WITH ALL ITS DEPENDENT SEGMENTS 10 Continued ... EXERCISE-2 HOW MANY DATABASE RECORDS? 11 IMS GENERAL CONCEPTS Continued ... IMS DATABASE LIMITATIONS IMS SUPPORTS 15 LEVELS 255 SEGMENTS 1000 FIELDS NO LIMITATION ON NUMBER OF SEGMENT OCCURRENCES. 12 IMS GENERAL CONCEPTS Continued ... IMS ENVIRONMENT DL/I FORMS BRIDGE BETWEEN APPLICATION PROGRAM AND IMS DATABASE DL/I IS DATABASE MANAGER. IT CONSISTS OF IMS PROGRAM MODULES THAT RUN EXTERNAL TO APPLICATION PROGRAM App Prog DB PCB interface I/O PCB interface DL/I DC Database Terminal DL/I ALLOWS SEQUENTIAL OR RANDOM PROCESSING OF DATABASE 13 IMS GENERAL CONCEPTS Continued ... IMS ENVIRONMENT MODES OF PROCESSING BATCH DL/I MODE MPP MODE BMP MODE ONLINE MPP BATCH BMP DL/I 14 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 15 IMS GENERAL CONCEPTS Continued ... IMS ENVIRONMENT BMP (BATCH MESSAGE PROCESSING) TWO TYPES 1. TRANSACTION ORIENTED: CAN READ & WRITE TO ONLINE MESSAGE QUEUES CAN PROCESS ONLINE FILES AND DATABASES 2. BATCH ORIENTED: CAN ONLY READ MESSAGE QUEUES ACCESS ONLINE DATABASES IN BATCH MODE 16 SESSION 2 DL/I CONTROL BLOCKS 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 18 DL/I CONTROL BLOCKS Continued ... DATA BASE DESCRIPTION (DBD) STATEMENTS IN DBD MACRO STATEMENT DESCRIPTION DBD SPECIFIES DATABASE NAME, ACCESS METHOD DATASET SPECIFIES DD NAME TO BE USED IN JCL, DISK TYPE SEGM SPECIFIES SEGMENT NAME,SEGMENT LENGTH, PARENT SPECIFIES FIELD NAME, LENGTH, STARTING POSITION IDENTIFIES A FIELD AS KEY OR SEARCH FIELD FIELD 19 DL/I CONTROL BLOCKS Continued ... SAMPLE DBDGEN PRINT DBD DATASET SEGM FIELD SEGM FIELD SEGM FIELD FIELD DBDGEN FINISH END NOGEN NAME=VENDOR,ACCESS=HDAM DD1=VEND,DEVICE=3380 NAME=VENSEG,PARENT=0,BYTES=10 NAME=(VENCODE,SEQ,U),BYTES=10,START=1,TYPE=C NAME=ITEMSEG,PARENT=VENSEG,BYTES=5 NAME=(ITEMCODE,SEQ,U),BYTES=5,START=1,TYPE=C NAME=LOCNSEG,PARENT=ITEMSEG,BYTES=9 NAME=(LOCNCODE,SEQ),BYTES=3,START=1,TYPE=C NAME=ORDDATE,BYTES=6,START=4,TYPE=C 20 DL/I CONTROL BLOCKS Continued ... DATATYPES USED IN DBDGEN TYPE DESCRIPTION COBOL PICTURE C Character (Default) X P Packed Decimal COMP-3 Z Zoned Decimal S9 H Half Word Binary 9(4) COMP F Full Word Binary 9(8) COMP 21 DL/I CONTROL BLOCKS Continued ... CAN WE DEFINE OVERLAPPING FIELDS? 22 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 23 DL/I CONTROL BLOCKS Continued ... PCB GIVES LOGICAL VIEW OF A DATABASE PORTION OF DATABASE THAT THE PROGRAM PROCESSES IS CALLED APPLICATION DATA STRUCTURE DATABASE PCB A B A C D C E E 24 DL/I CONTROL BLOCKS Continued ... SAMPLE PSBGEN PRINT NOGEN PCB TYPE=DB,DBDNAME=VENDOR,KEYLEN=15,PROCOPT=LS SENSEG NAME=VENSEG SENSEG NAME=ITEMSEG,PARENT=VENSEG PSBGEN END • KEYLEN IS THE LENGTH OF CONCATENATED KEY 25 DL/I CONTROL BLOCKS Continued ... PROCOPTS IN PSB DEFINES SECURITY LEVEL FOR THE PROGRAM DESCRIPTION PROCOPT G Get or Read I Insert R Replace D Delete A All Options (G, I, R, D) L Initial Load LS Sequential Initial Load K Access only Key of segment O Used with G to Indicate that Hold is not allowed P Path Calls 26 DL/I CONTROL BLOCKS Continued ... APPLICATION PROGRAM CAN HAVE MULTIPLE VIEWS OF A DATABASE BY USING SEPARATE PCBS FOR A SINGLE DATABASE PSB PCB1 PCB2 PCB3 DBD1 PCB4 DBD2 DBD3 27 DL/I CONTROL BLOCKS Continued ... PRINT NOGEN PCB TYPE=DB,DBDNAME=VENDOR,KEYLEN=15 SENSEG NAME=VENSEG,PROCOPT=G SENSEG NAME=ITEMSEG,PARENT=VENSEG,PROCOPT=R SENSEG NAME=LOCNSEG,PARENT=ITEMSEG,PROCOPT=A PSBGEN END 1. LIST THE SEGMENTS THAT MAY BE UPDATED USING THIS PSB 2. LIST THE SEGMENTS THAT CANNOT BE UPDATED 3. GIVE THE VALID PROCOPT TO BE CODED FOR ADDING AND REPLACING RECORDS IN LOCATION SEGMENT 28 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,DBDNAME=EMPDB,KEYLEN=16,PROCOPT=G SENSEG NAME=_________________,PARENT=_____________________ SENSEG NAME=_________________,PARENT=_____________________ SENSEG NAME=_________________,PARENT=_____________________ SENSEG NAME=_________________,PARENT=_____________________ PSBGEN LANG=COBOL,PSBNAME=EMPPSBY END 29 SESSION 3 SEGMENT SEARCH ARGUMENT 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 31 ContinuedARGUMENT ... SEGMENT SEARCH WHAT IS THE SIGNIFICANCE OF MAX 15 SSA? 32 ContinuedARGUMENT ... SEGMENT SEARCH TYPES OF SSAS UNQUALIFIED SEARCHES FOR A SPECIFIC SEGMENT TYPE QUALIFIED SEARCHES FOR A SPECIFIC SEGMENT OCCURRENCE MORE EFFICIENT THAN UNQUALIFIED SSA 33 ContinuedARGUMENT ... SEGMENT SEARCH UNQUALIFIED SSA WORKING-STORAGE-SECTION. ………….. 01 HISTORY-SSA. 05 SEGMENT-NAME PIC X(8) VALUE ‘HISTORY ‘. 05 FILLER PIC X(1) VALUE SPACE. 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 ContinuedARGUMENT ... SEGMENT SEARCH QUALIFIED SSA WORKING-STORAGE-SECTION. ………….. 01 SSA-EMPLOYEE. 03 SEGMENT-NAME PIC X(8) VALUE ‘EMPLOYEE’ 03 COMMAND-CODE PIC X(2) VALUE ‘*-’. 03 BEGIN-QUALIFY PIC X(1) VALUE ‘(‘. 03 KEY-NAME PIC X(8) VALUE ‘EMPKEY ‘. 03 OPERATOR PIC X(2) VALUE ‘ =‘. 03 KEY-VALUE PIC X(12) . 03 END-QUALIFY PIC X(1) VALUE ‘)‘. PROCEDURE DIVISION. ….. MOVE ‘123456789000’ TO KEY-VALUE. CALL ‘CBLTDLI’ USING FUNC-CODE, PCB-MASK-1, IO-AREA, SSA-EMPLOYEE. 35 ContinuedARGUMENT ... SEGMENT SEARCH OPERATORS USED IN QUALIFIED SSA OPERATOR SYMBOLS Equal to ‘EQ’, ‘= ‘, ‘ =‘ Not Equal to ‘NE’, ‘¬=‘, ‘=¬’ Less than ‘LT’, ‘< ‘, ‘ <‘ Less than or Equal to ‘LE’, ‘<=‘, ‘=<‘ Greater than ‘GT’, ‘> ‘, ‘ >’ Greater than or Equal to ‘GE’, ‘>=‘, ‘=>’ 36 ContinuedARGUMENT ... SEGMENT SEARCH 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” 37 SESSION 4 COBOL BASICS FOR IMS 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 FUNCTION CODES ENVIRONMENT DIVISION I/O AREA DATA DIVISION FILE SECTION WORKING STORAGE SECTION LINKAGE SECTION SEGMENT SEARCH ARGUMENTS PCB MASKS PROCEDURE DIVISION 39 COBOL BASICS IMS ContinuedFOR ... 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 40 COBOL BASICS IMS ContinuedFOR ... 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, THE I/O AREA MUST BE LARGE ENOUGH TO HOLD THE LARGEST CONCATENATION OF THESE SEGMENTS 41 COBOL BASICS IMS ContinuedFOR ... THE PCB MASK USED IN LINKAGE SECTION LINKAGE SECTION 01 DB-PCB-1. 03 DBD-NAME PIC X(8). 03 SEG-LEVEL PIC X(2). 03 STATUS-CODE PIC X(2). 03 PROC-OPTIONS PIC X(4). 03 IMS-RESERVED PIC S9(5) COMP. 03 SEG-NAME PIC X(8). 03 KEY-LEN PIC S9(5) COMP. 03 NUM-SENS-SEGS PIC S9(5) COMP. 03 KEY-FEEDBACK PIC X(??). <= length depends on segment key 42 COBOL BASICS IMS ContinuedFOR ... 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 43 COBOL BASICS IMS ContinuedFOR ... PROCEDURE DIVISION PROCEDURE DIVISION. ENTRY ‘DLITCBL’ USING DB-PCB-1, DB-PCB-2. <= Sequence should match that of :::::::::::: PSB Macro :::::::::::: CALL ‘CBLTDLI’ USING WS-PARM-COUNT, <= Optional WS-FUNCTION-CODE, DB-PCB-MASK, IO-AREA, SSA-1, SSA-2, SSA-3, …. :::::::::: :::::::::: GOBACK. 44 COBOL BASICS IMS ContinuedFOR ... RUN JCL EXECUTES THE BATCH PROCESSOR DFSRRC00 AND PASSES THE APPLICATION PROGRAM NAME AND PSBNAME AS PARAMETERS RUN JCL ENTRY DLITCBL PASSES THE PCB ADDRESS TO THE PROGRAM PROGRAM NAME PSB NAME IMS DATABASE CBLTDLI GOBACK DLITCBL DL/I APPLICATION PROGRAM CBLTDLI ACCEPTS PARAMETERS LIKE FUNCTION CODE, I/O AREA AND SSA TO DO THE NECESSARY DATABASE OPERATIONS AND RETURNS DATA AND STATUS CODES DESCRIBING THE SUCCESS OF THE CALL GOBACK IN THE COBOL PROGRAM TAKES THE CONTROL BACKTO DL/I WHICH PERFORMS IMS FILES CLOSING AND TERMINATES THE BATCH STEP. “STOP RUN” SHOULD NEVER BE USED AS IT WILL NOT FREE RESOURCES 45 SESSION 5 DL/I CALLS 46 DL/I CALLS DL/I RETRIEVAL CALLS ONE OF THE FOLLOWING FUNCTIONS WILL BE USED IN A RETRIEVAL DL/I CALL GU - GET UNIQUE GN - GET NEXT GNP - 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 - GET HOLD UNIQUE GHN - GET HOLD NEXT GHNP - GET HOLD NEXT WITHIN PARENT 47 DL/I CALLS Continued ... GET UNIQUE CALL ‘CBLTDLI’ USING ‘GU ‘, 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 11 7 BKEY 2 EKEY 8 6 4 10 3 5 CKEY 9 DKEY FKEY EXERCISE: WRITE A GU TO RETRIEVE FKEY=10 48 DL/I CALLS Continued ... WHAT WILL BE THE OUTPUT OF A GU CALL WITH NO SSA? 49 DL/I CALLS Continued ... GET NEXT RETREIVAL SEQUENCE TOP TO BOTTOM FRONT TO BACK AKEY 1 LEFT TO RIGHT EKEY 11 7 BKEY 2 8 GA 6 4 10 3 5 9 GK CKEY DKEY FKEY 50 DL/I CALLS Continued ... CALL ‘CBLTDLI’ USING ‘GN ‘, PCB-MASK, SEG-IO-AREA, SEGMENTA*-(AKEY=1) SEGMENTE*-(EKEY=8) AFTER THE CALL SEGMENTE WITH EKEY=8 WILL BE IN PROGRAM I/O AREA AKEY 1 7 EKEY 11 2 BKEY 8 6 4 3 10 5 CKEY 9 DKEY FKEY EXERCISE: WHAT WILL BE THE RESULTS OF FOUR CONSEQUETIVE GNs AFTER EKEY=8 IS RETRIEVED 51 DL/I CALLS Continued ... GET NEXT WITHIN PARENT CALL ‘CBLTDLI’ USING ‘GN ’, LS-PCB-MASK, SEGMENT-IO-AREA, SEGMENTA*-(AKEY=1) SEGMENTB*-(BKEY=2) CALL ‘CBLTDLI’ USING ‘GNP ‘, LS-PCB-MASK, SEGMENT-IO-AREA AFTER THE CALL SEGMENTC WITH CKEY=3 WILL BE IN SEGMENT-IO-AREA AKEY 1 11 7 2 BKEY EKEY 8 6 4 3 10 5 CKEY 9 DKEY FKEY 52 DL/I CALLS Continued ... WHAT WILL BE THE OUTPUT IF GNP IS DONE 4 MORE TIMES IN PREVIOUS EXAMPLE? 53 DL/I CALLS Continued ... PATH CALLS EXERCISE ‘CBLTDLI’ USING ‘GN ‘, LS-PCB-MASK, WS-SEG-IO-AREA, CALL SEGMENTA*D(AKEY=1) SEGMENTF*-(FKEY=10) WHAT WILL BE THE RESULT AFTER SUCCESSFUL COMPLETION OF THE ABOVE CALL? 1 11 7 2 BKEY EKEY 8 6 4 3 10 5 CKEY 9 DKEY FKEY 54 DL/I CALLS Continued ... 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 55 DL/I CALLS Continued ... DELETE/REPLACE CALLS MUST HAVE BEEN OBTAINED WITH A GET HOLD CALL (GHU, GHN, GHNP) NO INTERVENING CALLS BETWEEN GET HOLD CALL AND REPLACE/DELETE CALLS MULTIPLE REPLACE ALLOWED AFTER GET HOLD 56 DL/I CALLS Continued ... DELETE CALL CALL ‘CBLTDLI’ USING ‘GHU ‘, LS-PCB-MASK, WS-SEGMENT-IO-AREA SEGMENTA*-(AKEY=1) SEGMENTB*-(BKEY=2) CALL ‘CBLTDLI’ USING ‘DLET’, LS-PCB-MASK 1 11 7 2 BKEY EKEY 8 6 4 3 10 5 CKEY 9 DKEY WHAT WILL BE THE RESULT IF THE FIRST GHU CALL IS SEGMENTA*D(AKEY=1)? 57 DL/I CALLS Continued ... REPLACE (REPL) UPDATE CONTENTS OF A SEGMENT KEY FIELD MAY NOT BE ALTERED SSAs ARE NOT USED NORMALLY COMMAND CODES D - TO REPLACE PATH OF SEGMENTS N - TO EXCLUDE SEGMENTS FROM PATH STATUS CODES DA - TRYING TO CHANGE KEY DJ - NO PRECEDING GET HOLD CALL RX - REPLACE RULE VIOLATION 58 DL/I CALLS Continued ... CALL ‘CBLTDLI’ USING ‘GHU ‘, LS-PCB-MASK, WS-IO-AREA, SEGMENTA*-(AKEY=1) SEGMENTB*-(BKEY=2) SEGMENTC*-(CKEY=3) Change contents of WS-IO-AREA CALL ‘CBLTDLI USING ‘REPL’, LS-PCB-MASK, WS-IO-AREA WILL RESULT IN UPDATE OF SEGMENTC 1 11 7 2 BKEY EKEY 8 6 4 3 10 5 CKEY 9 DKEY FKEY 59 DL/I CALLS Continued ... INSERT (ISRT) TWO MODES OF INSERT LOAD MODE - FOR INITIAL LOADING OF DATABASE UPDATE MODE - ADD TO EXISTING DATABASE LOAD MODE: FOR LOAD MODE PROCOPT = L or LS MUST BE SPECIFIED IN PSB PROCOPT=L LOADS DATABASE BUT NOT NECESSARILY IN SEQUENTIAL ORDER 60 DL/I CALLS Continued ... INSERT (ISRT) UPDATE 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” - OVERRIDES INSERT RULE “D” - INSERT PATH OF SEGMENTS 61 DL/I CALLS Continued ... MOVE DATA FOR SEGMENTE INTO WS-SEGMENT-IO-AREA WITH EKEY=99 ‘CBLTDLI’ USING ‘ISRT’, LS-PCB-MASK, WS-SEGMENT-IO-AREA, CALL SEGMENTA*-(AKEY=1) SEGMENTE AFTER THE CALL SEGMENTE WITH EKEY=99 IS INSERTED 1 99 11 7 2 BKEY EKEY 8 6 4 3 10 5 CKEY 9 DKEY FKEY 62 DL/I CALLS Continued ... SOME COMMON STATUS CODES STATUS CODE DESCRIPTION CALL TYPES SPACES SUCCESSFUL CALL ALL CALLS AC CALL HAS SSA WITH A HIERARCHICAL ERROR ALL GET CALLS ISRT AI ERROR WHILE OPENING DATABASE. COMMON CAUSE IS LOADING A DATABASE WHICH IS NOT EMPTY OR DO OTHER THAN LOAD PROCESSING ON EMPTY DATABASE ALL CALLS AJ CALL SPECIFIES AN INVALID SSA ALL CALLS AK FIELD NAMED IN A QUALIFIED SSA IS NOT CORRECT ALL GET CALLS ISRT DA SEQUENCE FIELD IS CHANGED REPL DJ CALL IS NOT PRECEDED BY A SUCCESSFUL GET HOLD CALL DLET REPL GA A HIGHER LEVEL SEGMENT IS RETRIEVED IN SEQUENTIAL PROCESSING GN, GNP 63 DL/I CALLS Continued ... SOME COMMON STATUS CODES STATUS CODE DESCRIPTION CALL TYPES GB END OF DATA BASE WAS REACHED DURING SEQUENTIAL RETRIEVAL GN GE SPECIFIED SEGMENT NOT FOUND ALL GET CALLS ISRT GK A SEGMENT OF DIFFERENT TYPE, BUT AT THE SAME LEVEL IS RETRIEVED DURING SEQUENTIAL PROCESSING GN, GNP GP PROPER PARENTAGE IS NOT IN EFFECT GNP II DUPLICATE INSERT ISRT 64 SESSION 6 COMMAND CODES 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 66 COMMAND CODES Continued ... SOME COMMAND CODES COMMAND CODE DESCRIPTION D RETRIEVE A PATH F FIRST OCCURRENCE OF SEGMENT TYPE L LAST OCCURRENCE OF SEGMENT TYPE U MAINTAIN CURRENT POSITION AT THIS LEVEL V MAINTAIN CURRENT POSITION AT THIS AND HIGHER LEVELS N DO NOT REPLACE THIS SEGMENT C USE A CONCATENATED KEY P ESTABLISH PARENTAGE AT THIS LEVEL - NULL/IGNORE 67 COMMAND CODES Continued ... 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” 68 COMMAND CODES Continued ... 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, “D” COMMAND CODE IS PROPAGATED TO ALL SPECIFIED SEGMENTS AUTOMATICALLY I/O AREA USED SHOULD BE BIG ENOUGH TO ACCOMMODATE ALL SEGMENTS IN PATH 69 COMMAND CODES Continued ... PATH CALLS EXAMPLE CALL ‘CBLTDLI’ USING ‘GN ‘, LS-PCB-MASK, WS-SEG-IO-AREA, SEGMENTA*D(AKEY=1) SEGMENTB*D(BKEY=2) SEGMENTD*-(DKEY=5) AFTER THE CALL SEGMENTS #1, #2 & #5 WILL BE RETURNED IN I/O AREA AKEY 1 11 7 2 BKEY EKEY 8 6 4 3 10 5 CKEY 9 DKEY FKEY 70 COMMAND CODES Continued ... 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, WS-SEG-IO-AREA, SEGMENTB*F 1 SEGMENTA 4 2 SEGMENTB 3 SEGMENTC 71 COMMAND CODES Continued ... 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, WS-SEG-IO-AREA, SEGMENTC*L 1 SEGMENTA 4 2 3 SEGMENTB SEGMENTC 72 COMMAND CODES Continued ... 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 73 COMMAND CODES Continued ... 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, WS-IO-AREA SEGMENTA*P SEGMENTC WILL RETRIEVE SEGMENTC TO I/O AREA BUT PARENTAGE WILL BE SET TO SEGMENTA 1 2 SEGMENTA 3 SEGMENTB SEGMENTC 74 SESSION 7 DL/I CALL EXERCISE 75 DL/I CALL EXERCISE Continued ... COURSE COURSE# TITLE PREREQ COURSE# DESCRIPN OFFERING TITLE DATE TEACHER EMPNUM LOCATION FORMAT STUDENT NAME EMPNUM NAME GRADE 76 DL/I CALL EXERCISE Continued ... 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 77 DL/I CALL EXERCISE Continued ... 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” 78 DL/I CALL EXERCISE Continued ... 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 79 SESSION 8 DATABASE ACCESS METHODS 80 IMS DATABASE ACCESS METHODS DL/I PROVIDES TWO BASIC DATABASE ORGANIZATIONS HIERARCHICAL SEQUENTIAL (HS) HIERARCHICAL DIRECT (HD) Database Organization Access Methods HS HSAM - Hierarchical Sequential Access Method HISAM - Hierarchical Indexed Sequential Access Method SHSAM - Simple HSAM SHISAM - Simple HISAM HD HDAM - Hierarchical Direct Access Method HIDAM - Hierarchical Indexed Direct Access Method DL/I PROVIDES GSAM(Generalized Sequential Access Method) TO ACCESS NORMAL SEQUENTIAL DATASETS 81 IMS DATABASE ACCESS METHODS Continued ... HSAM / SHSAM SEGMENTS OF A DATABASE RECORD ARE STORED IN SEQUENTIAL ORDER VERY EFFICIENT FOR SEQUENTIAL PROCESSING NEW SEGMENTS CAN NOT BE INSERTED. DATABASE HAS TO BE UNLOADED AND LOADED AGAIN. ONCE DATABASE IS LOADED ONLY GET OPERATIONS ARE VALID (GU, GN , GNP, NOT “GET HOLD”) ISRT CALL IS VALID ONLY WHILE LOADING NEW DATABASE REPL AND DLET ARE NOT ALLOWED SHSAM IS A SUBSET OF HSAM AND CONTAINS ONLY ROOT SEGMENTS ONLY HSAM/SHSAM DATABASES CAN BE STORED ON A TAPE SEGMENTS CAN NOT SPAN OVER RECORDS 82 IMS DATABASE ACCESS METHODS Continued ... HSAM SEGMENT STORAGE IN DATABASE Delete byte ‘00’ -’FF’ ‘00’ SEGMENT DATA Segment Identifier HSAM DBDGEN DBD NAME=EXHSAM,ACCESS=HSAM DATASET DD1=EXHSAMI,DD2=EXHSAMO,DEVICE=3380,RECORD=(512,512) SEGM FIELD=……………. 83 IMS DATABASE ACCESS METHODS Continued ... HISAM / SHISAM SIMILAR TO HSAM AND IN ADDITION INDEX IS ADDED FOR DIRECT ACCESS TO ROOT SEGMENT VERY EFFICIENT FOR SEQUENTIAL AND FAIRLY GOOD FOR RANDOM PROCESSING HISAM DATABASE REQUIRES TWO SEPARATE DATASETS PRIMARY DATASET OVERFLOW DATASET OVERFLOW DATASET IS NOT REQUIRED FOR SHISAM SEGMENTS CAN BE DELETED PREFERABLE IF DATABASE HAS ROOT SEGMENTS ONLY 84 IMS DATABASE ACCESS METHODS Continued ... HISAM SEGMENT STORAGE IN DATABASE 4 Byte RBA RBA ‘00’ -’FF’ Delete byte ‘00’ SEGMENT DATA Segment Identifier HISAM DBDGEN DBD NAME=EXHISAM,ACCESS=(HISAM,VSAM) DATASET DD1=HISAMPR,OVFLW=HISAMOV,DEVICE=3380,RECORD=(512,512) SEGM FIELD=……………. 85 IMS DATABASE ACCESS METHODS Continued ... HDAM DIRECT ADDRESS POINTERS TO RELATED SEGMENTS ARE STORED ALONG WITH SEGMENTS VERY EFFICIENT FOR RANDOM PROCESSING BUT NOT FOR SEQUENTIAL PROCESSING ROOT SEGMENTS ARE STORED ACCORDING TO SOME RANDOMIZING SCHEME HDAM SEGMENT STORAGE IN DATABASE Delete byte ‘00’ -’FF’ ‘00’ POINTERS SEGMENT DATA Segment Identifier 86 IMS DATABASE ACCESS METHODS Continued ... HDAM DBDGEN DBD NAME=EXHDAM,ACCESS=(HDAM,VSAM),RMNAME=(DFSHDC10,,10) DATASET DD1=EXHDAM,DEVICE=3380 SEGM NAME=SEG1,BYTES=48,POINTER=TWIN FIELD ……………. SEGM NAME=SEG2,PARENT=((SEG1,SNGL)),BYTES=32,POINTER=TWIN ……. 87 IMS DATABASE ACCESS METHODS Continued ... HIDAM SIMILAR TO HDAM AND IN ADDITION INDEX TO ROOT SEGMENTS WILL BE STORED EFFICIENT FOR BOTH SEQUENTIAL AND RANDOM PROCESSING MOST COMMON TYPE OF DATABASE ORGANIZATION HIDAM DBDGEN DBD NAME=EXHIDAM,ACCESS=(HIDAM,VSAM),RMNAME=(DFSHDC10,,10) DATASET DD1=EXHIDAM,DEVICE=3380 SEGM NAME=SEG1,BYTES=48,POINTER=TWIN FIELD ……………. SEGM NAME=SEG2,PARENT=((SEG1,SNGL)),BYTES=32,POINTER=TWIN ……. 88 IMS DATABASE ACCESS METHODS Continued ... GSAM COMPATIBLE WITH MVS DATASETS NO HIERARCHY CAN HAVE FIXED OR VARIABLE LENGTH RECORDS NO DELETE OR REPLACE INSERT ONLY AT THE END OF DATASET GETS RECORDS SEQUENTIALLY USUALLY USED WHEN CHECK/POINT RESTART IS USED 89 SESSION 9 MULTIPLE PROCESSING 90 MULTIPLE PROCESSING MULTIPLE PROCESSING MEANS A PROGRAM CAN HAVE MORE THAN ONE POSITION IN A SINGLE DATABASE AT THE SAME TIME ESTABLISHED BY MULTIPLE PCBS MULTIPLE POSITIONING MULTIPLE PCBS CAN BE DEFINED AND USED FOR A SINGLE DATABASE TO ESTABLISH MULTIPLE POSITIONING HAS THE DRAWBACK OF IMPOSING OVERHEAD DUE TO THE EXTRA PCBS THUS CAUSING INEFFICIENCY 91 MULTIPLE PROCESSING Continued ... MULTIPLE POSITIONING LETS A PROGRAM MAINTAIN MORE THAN ONE POSITION WITHIN A DATABASE USING A SINGLE PCB. THE PCB HAS TO BE CODED SUITABLY IN ORDER TO ACHIEVE THIS (POS=M) MULTIPLE POSITIONING IS MORE EFFICIENT THAN USING MULTIPLE PCBS WHEREAS MULTIPLE PCBS OFFER MORE FLEXIBILITY 92 MULTIPLE PROCESSING Continued ... EXAMPLE CALLS GN SEGMENTB, GN SEGMENTC, GN SEGMENTB, GN SEGMENTC A1 A2 C13 B13 B12 B11 C12 C11 C22 B22 B21 C21 93 SESSION 10 SECONDARY INDEXING 94 SECONDARY INDEXING ALLOWS YOU TO ACCESS DB IN A SEQUENCE OTHER THAN PRIMARY SEQUENCE ALLOWS YOU TO ACCESS A SEGMENT WITHOUT SUPPLYING ITS CONCATENATED KEY THE SECONDARY INDEX ITSELF IS A DATABASE WITH ITS OWN DBD DEFINITION SECONDARY INDEX DATABASE CONTAINS POINTER TO TARGET SEGMENT AND KEY VALUE OF SOURCE SEGMENT 95 SECONDARY INDEXING SECONDARY INDEX DATABASE IS MAINTAINED AUTOMATICALLY BY DL/I SECONDARY DATA STRUCTURES NEED TO USE PROCSEQ OPTION IN PCB STATEMENT OF PSBGEN MACRO ELSE DATABASE IS ACCESSED AS PER NORMAL HIERARCHY DATABASE TO BE INDEXED MUST BE IN HISAM, HDAM, OR HIDAM, NOT IN HSAM LIMITATIONS: 32 SECONDARY INDICES ON ONE SEGMENT TYPE 1000 SECONDARY INDICES FOR A DATABASE 96 Continued ... SECONDARY INDEXING Indexed Database Secondary Index DB Prefix | Data Customer Pointer Invoice No Index pointer segment Index Target Segment Ship-to Index Source Segment Buyer Receivable Payment Adjustment Line Item 97 Continued ... SECONDARY INDEXING SECONDARY DATA STRUCTURE Receivable Ship-to Customer Payment Adjustment Line Item Buyer 98 Continued ... SECONDARY INDEXING Indexed Database Secondary Index DB Prefix | Data Customer Pointer Invoice No Index Index pointer segment Target Segment Ship-to Index Source Segment Buyer Receivable Payment Adjustment Line Item 99 Continued ... SECONDARY INDEXING COURSE COURSE# TITLE PREREQ COURSE# DESCRIPN OFFERING TITLE DATE TEACHER EMPNUM LOCATION FORMAT STUDENT NAME EMPNUM NAME GRADE 10 0 Continued ... SECONDARY INDEXING INDEXING THE ROOT ON A FIELD NOT THE SEQUENCE FIELD MAINDBD MACRO INDEX DBD MACRO DBD SEGM FIELD FIELD LCHILD XDFLD DBD SEGM FIELD LCHILD NAME=EDUCPDBD NAME=COURSE,BYTES=256 NAME=(COURSE#,SEQ),BYTE3,START=1 NAME=TITLE,BYTES=33,START=4 NAME=(TPTR,TXDBD),POINTER=INDX NAME=XTITLE,SRCH=TITLE NAME=TXDBD,ACCESS=INDEX NAME=TPTR,BYTES=33 NAME=(TITLE,SEQ),BYTES=33,START=1 NAME=(COURSE,EDUCPDBD),INDEX=XTITLE PSB MACRO PCB SYNTAX: SENSEG SENSEG SENSEG TYPE=DB,DBDNAME=EDUCPDBD,KEYLEN=15 PROCOPT=G,PROCSEQ=TXDBD NAME=COURSE NAME=OFFERING,PARENT=COURSE NAME=STUDENT,PARENT=OFFERING GU COURSE (XTITLE=‘DYNAMICS’) 10 1 Continued ... SECONDARY INDEXING WHAT HAPPENS IF “PROCSEQ=TXDBD” IS NOT USED? DL/I BY DEFAULT USES PRIMARY PROCESSING SEQUENCE 10 2 Continued ... SECONDARY INDEXING INDEXING THE ROOT ON A FIELD IN THE DEPENDENT MAINDBD MACRO INDEX DBD MACRO DBD SEGM FIELD FIELD LCHILD XDFLD DBD SEGM FIELD LCHILD NAME=EDUCPDBD NAME=COURSE,BYTES=256 NAME=(COURSE#,SEQ),BYTE3,START=1 NAME=TITLE,BYTES=33,START=4 NAME=(LPTR,LXDBD),POINTER=INDX NAME=XLOC,SRCH=LOCATION,SEGMENT=OFFERING SYNTAX: GU NAME=LXDBD,ACCESS=INDEX NAME=LPTR,BYTES=.. NAME=(LOCATION,SEQ),BYTES=…. NAME=(COURSE,EDUCPDBD),INDEX=XLOC COURSE (XLOC=‘CHENNAI’) 10 3 SESSION 11 LOGICAL RELATIONSHIPS 10 4 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- 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 10 5 ... LOGICAL Continued RELATIONSHIPS Logical Parent PART Database ORDER Database of DETAIL Physical Parent PART ORDER of DETAIL Logical Relationship STOCK DETAIL SHIPMENT Logical Children Physical Children of PART of ORDER 10 6 ... LOGICAL Continued RELATIONSHIPS PART /ORDER ORDER/PART Logical Database Logical Database PART STOCK DETAIL SHIPMENT ORDER ORDER DETAIL PART SHIPMENT STOCK 10 7 SESSION 12 DB RECOVERY / RESTART 10 8 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 10 9 DATABASE RECOVERY Continued ... 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 11 0 DATABASE RECOVERY Continued ... UTILITIES FOR RECOVERY DFSUDMP0: DATABASE IMAGE COPY UTILITY FOR CREATION OF IMAGE COPIES OF DATABASES DFSUCUM0: DATABASE CHANGE ACCUMULATION UTILITY FOR ACCUMULATION OF DATABASE CHANGES FROM DL/I LOG TAPES SINCE THE LAST COMPLETE IMAGE COPY DFSURDB0: DATABASE RECOVERY UTILITY FOR RESTORATION OF THE DATABASE, USING A PRIOR DATABASE IMAGE COPY AND THE ACCUMULATED CHANGES FROM DL/I LOG TAPES DFSBBO00: DATABASE BACK OUT UTILITY FOR REMOVAL OF CHANGES MADE TO DATABASES BY A SPECIFIC APPLICATION PROGRAM 111 DATABASE RECOVERY Continued ... 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. 11 2 DATABASE RECOVERY Continued ... 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 11 3 DATABASE RECOVERY Continued ... 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. OUTPUTS BACKED OUT DATABASES LOG DATASETS 11 4 DATABASE RECOVERY Continued ... HOW DO YOU BACK OUT A NORMALLY TERMINATED PROGRAM? BY GIVING DBRC=C IN THE JCL SHOWN BELOW //STEP1 // // // // // //* EXEC PGM=DFSRRC00, REGION=5632K, PARM=(DLI,&MBR,&PSB,, &SPIE&TEST&EXCPVR&RST,&PRLD, &SRCH,&CKPTID,&MON,,&FMTO,,&SWAP, &DBRC,&IRLM,&IRLMNM,&BKO) 11 5 DATABASE RECOVERY Continued ... 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 •SYMBOLIC CHECKPOINT –STORES CRITICAL DATA APART FROM CHECKPOINT ID –MUST USE XRST FOR RESTARTING –SYNTAX: CALL ‘CBLTDLI’ USING WS-CHKP, IO-PCB, IO-AREA-LEN, IO-AREA, IO-AREA-LEN1, IO-AREA1… 11 6 DATABASE RECOVERY Continued ... 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-PCB, IO-AREA-LEN, IO-AREA, IO-AREA-LEN1, IO-AREA1… 11 7 DATABASE RECOVERY Continued ... FACTORS TO BE CONSIDERED FOR CHKP & XRST CALLS ALL FILES (INCLUDING SYSIN, 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,KEEP,KEEP) FOR INITIAL RUN AND DISP=(OLD,KEEP,KEEP) FOR RESTARTS 11 8 SESSION 13 EFFICIENT PROGRAMMING TIPS 11 9 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 12 0 Continued ... TIPS PROGRAMMING 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. 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 12 1 SESSION 14 COMMON IMS ABENDS 12 2 COMMON IMS ABENDS U0047 DESCRIPTION ONE OF THE DBPCBS IN THE PSB FAILED TO OBTAIN THE DATABASE AUTHORIZATION THROUGH DBRC. USUALLY OCCURS WHEN DATABASE IS UP IN ONLINE OR DATABASE IS USED IN UPDATE MODE BY ANOTHER PROGRAM. SOLUTION •BRING DOWN THE DATABASE USING /DBR DB DATABASE NAME •WAIT TILL CONTENDING JOB COMPLETES AND RESTART THE JOB 12 3 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 12 4 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 12 5 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, RECOVER THE DATABASE. 12 6 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 12 7