You are on page 1of 127

IMS - DB

SESSION 1 SESSION 2 SESSION 3

IMS GENERAL CONCEPTS DL/I CONTROL BLOCKS SEGMENT SEARCH ARGUMENTS (SSAs)

SESSION 4
SESSION 5 SESSION 6 SESSION 7

COBOL BASICS FOR IMS


DL/I CALLS COMMAND CODES DL/I CALLS EXERCISE

SESSION 8
SESSION 9 SESSION 10 SESSION 11

DATABASE ACCESS METHODS


MULTIPLE PROCESSING SECONDARY INDEXING LOGICAL RELATIONSHIP

SESSION 12
SESSION 13 SESSION 14

DB RECOVERY/RESTART
EFFICIENT PROGRAMMING TIPS COMMON IMS ABENDS
2

SESSION 1

IMS GENERAL CONCEPTS

IMS GENERAL CONCEPTS

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

IMS GENERAL CONCEPTS


HIERARCHICAL STRUCTURE
ROOT SEGMENT (PARENT)

Continued ...

FOLLOWS INVERTED TREE STRUCTURE


A2 A1

-- Level 1

EACH BOX IN THE HIERARCHY REPRESENTS A SEGMENT

SEGMENT OCCURRNCES

ROOT SEGMENT WILL BE ON TOP


EACH SEGMENT (EXCEPT ROOT SEGMENT) IS DIRECTLY DEPENDENT ON ONLY ONE
C1 D1

B3 B1 B2

-- Level 2

SEGMENT

TWIN SEGMENTS

DEPENDENT SEGMENTS

IMS GENERAL CONCEPTS

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

IMS GENERAL CONCEPTS


TWO TYPES OF FIELDS KEY FIELDS

Continued ...

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

IMS GENERAL CONCEPTS


TYPES OF SEGMENTS
ROOT PARENT A SEGMENT WITHOUT PARENT

Continued ...

A SEGMENT WITH ONE OR MORE DEPENDENT SEGMENTS DIRECTLY UNDER IT A SEGMENT WHICH IS DIRECTLY DEPENDENT ON ANOTHER CHILD 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

DEPENDENT

TWIN

SIBLINGS

IMS GENERAL CONCEPTS


EXERCISE - 1
1

Continued ...

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?

IMS GENERAL CONCEPTS


DATABASE RECORD

Continued ...

ONE OCCURRENCE OF A ROOT SEGMENT ALONG WITH ALL ITS DEPENDENT SEGMENTS

10

IMS GENERAL CONCEPTS


EXERCISE-2

Continued ...

HOW MANY DATABASE RECORDS?

11

IMS GENERAL CONCEPTS


IMS DATABASE LIMITATIONS
IMS SUPPORTS 15 LEVELS 255 SEGMENTS 1000 FIELDS

Continued ...

NO LIMITATION ON NUMBER OF SEGMENT OCCURRENCES.

12

IMS GENERAL CONCEPTS


IMS ENVIRONMENT
DL/I FORMS BRIDGE BETWEEN APPLICATION PROGRAM AND IMS DATABASE DB PCB interface

Continued ...

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

13

IMS GENERAL CONCEPTS


IMS ENVIRONMENT
MODES OF PROCESSING BATCH DL/I MODE MPP MODE BMP MODE

Continued ...

ONLINE

BATCH

MPP

BMP

DL/I

14

IMS GENERAL CONCEPTS


IMS ENVIRONMENT
BATCH DL/I TRUE BATCH PROCESSING NO DATA COMMUNICATION SERVICES ARE USED DATABASES ACCESSED MUST BE OFFLINE

Continued ...

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


IMS ENVIRONMENT
BMP (BATCH MESSAGE PROCESSING)

Continued ...

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


DATA BASE DESCRIPTION (DBD)

Continued ...

STATEMENTS IN DBD MACRO STATEMENT DESCRIPTION

DBD
DATASET SEGM FIELD

SPECIFIES DATABASE NAME, ACCESS METHOD


SPECIFIES DD NAME TO BE USED IN JCL, DISK TYPE SPECIFIES SEGMENT NAME,SEGMENT LENGTH, PARENT SPECIFIES FIELD NAME, LENGTH, STARTING POSITION IDENTIFIES A FIELD AS KEY OR SEARCH FIELD

19

DL/I CONTROL BLOCKS


SAMPLE DBDGEN
PRINT DBD DATASET SEGM FIELD SEGM FIELD SEGM FIELD FIELD DBDGEN FINISH END

Continued ...

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


DATATYPES USED IN DBDGEN

Continued ...

TYPE C P

DESCRIPTION Character (Default) Packed Decimal

COBOL PICTURE X COMP-3

Z
H F

Zoned Decimal
Half Word Binary Full Word Binary

S9
9(4) COMP 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 PROGRAMS 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


PCB GIVES LOGICAL VIEW OF A DATABASE

Continued ...

PORTION OF DATABASE THAT THE PROGRAM PROCESSES IS CALLED APPLICATION DATA STRUCTURE DATABASE PCB
A

24

DL/I CONTROL BLOCKS


SAMPLE PSBGEN

Continued ...

PRINT
PCB

NOGEN
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


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, I, R, D) DESCRIPTION

Continued ...

Initial Load
Sequential Initial Load

Access only Key of segment


Used with G to Indicate that Hold is not allowed 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

PCB4

DBD1

DBD2

DBD3

27

DL/I CONTROL BLOCKS


PRINT PCB NOGEN TYPE=DB,DBDNAME=VENDOR,KEYLEN=15

Continued ...

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


EMPDATA

Continued ...

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

SEGMENT SEARCH ARGUMENT

Continued ...

WHAT IS THE SIGNIFICANCE OF MAX 15 SSA?

32

SEGMENT SEARCH ARGUMENT


TYPES OF SSAS
UNQUALIFIED

Continued ...

SEARCHES FOR A SPECIFIC SEGMENT TYPE

QUALIFIED SEARCHES FOR A SPECIFIC SEGMENT OCCURRENCE

MORE EFFICIENT THAN UNQUALIFIED SSA

33

SEGMENT SEARCH ARGUMENT


UNQUALIFIED SSA
WORKING-STORAGE-SECTION.

Continued ...

..
01 HISTORY-SSA. 05 05 SEGMENT-NAME PIC X(8) VALUE HISTORY . 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

SEGMENT SEARCH ARGUMENT


QUALIFIED SSA

Continued ...

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

SEGMENT SEARCH ARGUMENT


OPERATORS USED IN QUALIFIED SSA

Continued ...

OPERATOR

SYMBOLS

Equal to
Not Equal to Less than

EQ, = , =
NE, =, = LT, < , <

Less than or Equal to


Greater than Greater than or Equal to

LE, <=, =<


GT, > , > GE, >=, =>

36

SEGMENT SEARCH ARGUMENT


COMMAND CODES
COMMAND CODES INCREASE THE FUNCTIONALITY OF IMS CALLS

Continued ...

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 ENVIRONMENT DIVISION

FUNCTION CODES I/O AREA

DATA DIVISION FILE SECTION WORKING STORAGE SECTION LINKAGE SECTION


PROCEDURE DIVISION

SEGMENT SEARCH ARGUMENTS


PCB MASKS

39

COBOL BASICS FOR IMS


FUNCTION CODES

Continued ...

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 FOR IMS


INPUT/OUTPUT AREA

Continued ...

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 FOR IMS


THE PCB MASK
USED IN LINKAGE SECTION LINKAGE SECTION
01 DB-PCB-1. 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). PIC X(2). PIC X(2). PIC X(4). PIC S9(5) COMP. PIC X(8). PIC S9(5) COMP. PIC S9(5) COMP.

Continued ...

PIC X(??). <= length depends on segment key 42

COBOL BASICS FOR IMS


THE PCB MASK
THERE SHOULD BE ATLEAST ONE PCB FOR EACH DATABASE USED

Continued ...

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 FOR IMS


PROCEDURE DIVISION
PROCEDURE DIVISION.

Continued ...

ENTRY DLITCBL USING DB-PCB-1, DB-PCB-2. <= Sequence should match that of :::::::::::: :::::::::::: CALL CBLTDLI USING WS-PARM-COUNT, WS-FUNCTION-CODE, DB-PCB-MASK, IO-AREA, SSA-1, SSA-2, SSA-3, . :::::::::: :::::::::: GOBACK.
44

PSB Macro

<= Optional

COBOL BASICS FOR IMS

Continued ...

RUN JCL

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

PROGRAM NAME PSB NAME

DL/I

IMS DATABASE

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

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. 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
GN GNP

- GET UNIQUE
- GET NEXT - 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 - GET HOLD NEXT

GHNP - GET HOLD NEXT WITHIN PARENT

47

DL/I CALLS
GET UNIQUE
CALL CBLTDLI USING

Continued ...

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 EKEY

7 2

11

BKEY

6 4 3 5 9 10

CKEY

DKEY

FKEY 48

EXERCISE: WRITE A GU TO RETRIEVE FKEY=10

DL/I CALLS

Continued ...

WHAT WILL BE THE OUTPUT OF A GU CALL WITH NO SSA?

49

DL/I CALLS
GET NEXT
RETREIVAL SEQUENCE TOP TO BOTTOM
AKEY

Continued ...

FRONT TO BACK
LEFT TO RIGHT

7 2

11

EKEY

BKEY
GA

6 4 3 GK 5 9 10

CKEY

DKEY

FKEY

50

DL/I CALLS
CALL CBLTDLI USING GN , PCB-MASK, SEG-IO-AREA, SEGMENTA*-(AKEY=1) SEGMENTE*-(EKEY=8)

Continued ...

AFTER THE CALL SEGMENTE WITH EKEY=8 WILL BE IN PROGRAM I/O AREA

AKEY

7 2

11

EKEY

BKEY

6 4 3 5 9 10

CKEY

DKEY

FKEY

EXERCISE: WHAT WILL BE THE RESULTS OF FOUR CONSEQUETIVE GNs AFTER EKEY=8 IS RETRIEVED
51

DL/I CALLS
GET NEXT WITHIN PARENT
CALL CBLTDLI USING GN , LS-PCB-MASK, SEGMENT-IO-AREA, SEGMENTA*-(AKEY=1)

Continued ...

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
1

AKEY

7 2

11

EKEY

BKEY
6

4 3 5 9

10

CKEY

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
PATH CALLS EXERCISE
CALL CBLTDLI USING GN , LS-PCB-MASK, WS-SEG-IO-AREA, SEGMENTA*D(AKEY=1) SEGMENTF*-(FKEY=10)

Continued ...

WHAT WILL BE THE RESULT AFTER SUCCESSFUL COMPLETION OF THE ABOVE CALL?
1

7 2

11

EKEY

BKEY
6

4 3 5 9

10

CKEY

DKEY

FKEY 54

DL/I CALLS
GET HOLD CALLS (GHU/GHN/GHNP)
FUNCTIONS IDENTICAL TO GU/GN/GNP

Continued ...

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
DELETE/REPLACE CALLS

Continued ...

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
DELETE CALL
CALL CBLTDLI USING GHU , LS-PCB-MASK, WS-SEGMENT-IO-AREA SEGMENTA*-(AKEY=1)

Continued ...

SEGMENTB*-(BKEY=2)
CALL CBLTDLI USING DLET, LS-PCB-MASK
1

7 2

11

EKEY

BKEY
6

4 3 5 9

10

CKEY

DKEY

WHAT WILL BE THE RESULT IF THE FIRST GHU CALL IS SEGMENTA*D(AKEY=1)?


57

DL/I CALLS
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

Continued ...

58

DL/I CALLS
CALL CBLTDLI USING GHU , LS-PCB-MASK, WS-IO-AREA, SEGMENTA*-(AKEY=1) SEGMENTB*-(BKEY=2) SEGMENTC*-(CKEY=3)

Continued ...

Change contents of WS-IO-AREA


CALL CBLTDLI USING REPL, LS-PCB-MASK, WS-IO-AREA WILL RESULT IN UPDATE OF SEGMENTC
1

7 2

11

EKEY

BKEY
6

10

CKEY

DKEY

FKEY 59

DL/I CALLS
INSERT (ISRT)
TWO MODES OF INSERT

Continued ...

LOAD MODE
UPDATE MODE LOAD MODE:

- FOR INITIAL LOADING OF DATABASE


- ADD TO EXISTING DATABASE

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
INSERT (ISRT)
UPDATE MODE:

Continued ...

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 - OVERRIDES INSERT RULE - INSERT PATH OF SEGMENTS

61

DL/I CALLS
MOVE DATA FOR SEGMENTE INTO WS-SEGMENT-IO-AREA WITH EKEY=99 CALL CBLTDLI USING ISRT, LS-PCB-MASK, WS-SEGMENT-IO-AREA, SEGMENTA*-(AKEY=1) SEGMENTE AFTER THE CALL SEGMENTE WITH EKEY=99 IS INSERTED

Continued ...

1 99 7 2 11

EKEY

BKEY
6

10

CKEY

DKEY

FKEY 62

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

Continued ...

ALL GET CALLS ISRT ALL CALLS

AJ AK DA DJ GA

ALL CALLS ALL GET CALLS ISRT REPL DLET REPL GN, GNP

63

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, BUT AT THE SAME LEVEL IS RETRIEVED DURING SEQUENTIAL PROCESSING PROPER PARENTAGE IS NOT IN EFFECT DUPLICATE INSERT CALL TYPES GN

Continued ...

ALL GET CALLS ISRT GN, GNP GNP 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
SOME COMMAND CODES

Continued ...

COMMAND CODE D

DESCRIPTION

RETRIEVE A PATH
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
67

F
L U V N C P -

COMMAND CODES
COMMAND CODE D
REQUESTS DL/I TO USE PATH CALLS

Continued ...

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
COMMAND CODE D

Continued ...

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
PATH CALLS EXAMPLE
CALL CBLTDLI USING GN , LS-PCB-MASK, WS-SEG-IO-AREA, SEGMENTA*D(AKEY=1)

Continued ...

SEGMENTB*D(BKEY=2)
SEGMENTD*-(DKEY=5) AFTER THE CALL SEGMENTS #1, #2 & #5 WILL BE RETURNED IN I/O AREA
1

AKEY

7 2

11

EKEY

BKEY
6

4 3 5 9

10

CKEY

DKEY

FKEY 70

COMMAND CODES
COMMAND CODE F
CALL PROCESSES FIRST OCCURRENCE OF THE SEGMENT TYPE

Continued ...

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 3

SEGMENTB

SEGMENTC

71

COMMAND CODES
COMMAND CODE L
CALL PROCESSES LAST OCCURRENCE OF THE SEGMENT TYPE

Continued ...

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
COMMAND CODE N
USED IN REPL CALLS FOLLOWING PATH CALLS

Continued ...

IF ANY SEGMENT RETRIEVED DURING PATH CALL NEED NOT BE REPLACED


COMMAND CODE N IS USED IN SSA OF THAT SEGMENT

73

COMMAND CODES
COMMAND CODE P

Continued ...

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

SEGMENTA

SEGMENTB

SEGMENTC 74

SESSION 7

DL/I CALL EXERCISE

75

DL/I CALL EXERCISE

Continued ...

COURSE COURSE# TITLE DESCRIPN

PREREQ COURSE# TITLE

OFFERING DATE LOCATION FORMAT

TEACHER EMPNUM NAME

STUDENT EMPNUM NAME GRADE

76

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

Continued ...

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


5. GET ALL STUDENTS WITH GRADE OF A IN COURSE IMS

Continued ...

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


9. GET THE FIRST OFFERING OCCURRENCE WHERE THE LOCATION IS CHENNAI, TOGETHER WITH ITS PARENT COURSE OCCURRENCE

Continued ...

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
HS

Access Methods
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


HSAM / SHSAM SEGMENTS OF A DATABASE RECORD ARE STORED IN SEQUENTIAL ORDER

Continued ...

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


HSAM SEGMENT STORAGE IN DATABASE
Delete byte

Continued ...

00 -FF

00

SEGMENT DATA

Segment Identifier

HSAM DBDGEN
DBD NAME=EXHSAM,ACCESS=HSAM FIELD=.

DATASET DD1=EXHSAMI,DD2=EXHSAMO,DEVICE=3380,RECORD=(512,512) SEGM

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


HISAM SEGMENT STORAGE IN DATABASE
4 Byte RBA Delete byte

Continued ...

RBA

00 -FF

00

SEGMENT DATA

Segment Identifier

HISAM DBDGEN
DBD NAME=EXHISAM,ACCESS=(HISAM,VSAM) FIELD=.

DATASET DD1=HISAMPR,OVFLW=HISAMOV,DEVICE=3380,RECORD=(512,512) SEGM

85

IMS DATABASE ACCESS METHODS


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

Continued ...

HDAM SEGMENT STORAGE IN DATABASE


Delete byte

00 -FF

00

POINTERS

SEGMENT DATA

Segment Identifier 86

IMS DATABASE ACCESS METHODS


HDAM DBDGEN
DBD NAME=EXHDAM,ACCESS=(HDAM,VSAM),RMNAME=(DFSHDC10,,10)

Continued ...

DATASET DD1=EXHDAM,DEVICE=3380

SEGM
FIELD SEGM .

NAME=SEG1,BYTES=48,POINTER=TWIN
. NAME=SEG2,PARENT=((SEG1,SNGL)),BYTES=32,POINTER=TWIN

87

IMS DATABASE ACCESS METHODS


HIDAM SIMILAR TO HDAM AND IN ADDITION INDEX TO ROOT SEGMENTS WILL BE STORED

Continued ...

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 FIELD SEGM . NAME=SEG1,BYTES=48,POINTER=TWIN . NAME=SEG2,PARENT=((SEG1,SNGL)),BYTES=32,POINTER=TWIN

88

IMS DATABASE ACCESS METHODS


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

Continued ...

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
EXAMPLE
CALLS

Continued ...

GN SEGMENTB, GN SEGMENTC, GN SEGMENTB, GN SEGMENTC


A1 A2

B13 B12 B11 C11 C12

C13

B22

C22

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

SECONDARY INDEXING

Continued ...

Indexed Database
Customer

Secondary Index DB

Prefix | Data
Pointer Invoice No

Index pointer segment

Index Target Segment


Ship-to

Index

Source Segment
Buyer Receivable

Payment

Adjustment

Line Item 97

SECONDARY INDEXING
SECONDARY DATA STRUCTURE

Continued ...

Receivable

Ship-to

Payment

Adjustment

Line Item

Customer

Buyer

98

SECONDARY INDEXING

Continued ...

Indexed Database
Customer

Secondary Index DB
Prefix | Data
Index Target Segment
Pointer Invoice No

Index pointer segment

Ship-to

Index

Source Segment
Buyer Receivable

Payment

Adjustment

Line Item 99

SECONDARY INDEXING
COURSE COURSE# TITLE DESCRIPN

Continued ...

PREREQ COURSE# TITLE

OFFERING DATE LOCATION FORMAT

TEACHER
EMPNUM NAME

STUDENT
EMPNUM NAME GRADE

100

SECONDARY INDEXING
INDEXING THE ROOT ON A FIELD NOT THE SEQUENCE FIELD
MAINDBD MACRO
DBD SEGM FIELD FIELD LCHILD XDFLD 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

Continued ...

INDEX DBD MACRO


DBD SEGM FIELD LCHILD NAME=TXDBD,ACCESS=INDEX NAME=TPTR,BYTES=33 NAME=(TITLE,SEQ),BYTES=33,START=1 NAME=(COURSE,EDUCPDBD),INDEX=XTITLE

PSB MACRO
PCB SENSEG SENSEG SENSEG TYPE=DB,DBDNAME=EDUCPDBD,KEYLEN=15 PROCOPT=G,PROCSEQ=TXDBD NAME=COURSE NAME=OFFERING,PARENT=COURSE NAME=STUDENT,PARENT=OFFERING

SYNTAX:

GU

COURSE (XTITLE=DYNAMICS)
101

SECONDARY INDEXING

Continued ...

WHAT HAPPENS IF PROCSEQ=TXDBD IS NOT USED? DL/I BY DEFAULT USES PRIMARY PROCESSING SEQUENCE

102

SECONDARY INDEXING
INDEXING THE ROOT ON A FIELD IN THE DEPENDENT
MAINDBD MACRO
DBD SEGM FIELD FIELD LCHILD XDFLD 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

Continued ...

INDEX DBD MACRO


DBD SEGM FIELD LCHILD NAME=LXDBD,ACCESS=INDEX NAME=LPTR,BYTES=.. NAME=(LOCATION,SEQ),BYTES=. NAME=(COURSE,EDUCPDBD),INDEX=XLOC

SYNTAX:

GU

COURSE (XLOC=CHENNAI)
103

SESSION 11

LOGICAL RELATIONSHIPS

104

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

105

LOGICAL RELATIONSHIPS
Logical Parent PART Database PART Logical Relationship of DETAIL ORDER ORDER Database

Continued ...

Physical Parent of DETAIL

STOCK

DETAIL

SHIPMENT

Logical Children of PART

Physical Children of ORDER

106

LOGICAL RELATIONSHIPS
PART /ORDER
Logical Database
PART

Continued ...

ORDER/PART
Logical Database
ORDER

STOCK

DETAIL

ORDER

DETAIL

PART

SHIPMENT

SHIPMENT

STOCK

107

SESSION 12

DB RECOVERY / RESTART

108

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

109

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

110

DATABASE RECOVERY
UTILITIES FOR RECOVERY
DFSUDMP0: DATABASE IMAGE COPY UTILITY FOR CREATION OF IMAGE COPIES OF DATABASES

Continued ...

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
DATABASE RECOVERY CONTROL (DBRC)

Continued ...

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.
112

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

113

DATABASE RECOVERY
BACKWARD RECOVERY

Continued ...

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

114

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)

115

DATABASE RECOVERY
CHECKPOINT CALL (CHKP)
CHECKPOINT RESTART IS USED DURING BACKWARD RECOVERY

Continued ...

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
116

DATABASE RECOVERY
RESTART CALL(XRST)
USED TO RESTART A PROGRAM AFTER ABNORMAL TERMINATION
RESTART FROM SPECIFIC CHECKPOINT ID TIME/DATESTAMP

Continued ...

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

117

DATABASE RECOVERY
FACTORS TO BE CONSIDERED FOR CHKP & XRST CALLS

Continued ...

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

118

SESSION 13

EFFICIENT PROGRAMMING TIPS

119

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

120

PROGRAMMING TIPS

Continued ...

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

121

SESSION 14

COMMON IMS ABENDS

122

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

123

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

124

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

125

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.

126

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

127