Page : 1/128
To create awareness about the IMS DB technology and how it is used to perform data base operations. Target audience :- people who are relatively new to the IMS DB Technology.
Page : 2/128
Knowledge of COBOL Basic knowledge of data base management concepts
Page : 3/128
9. 6. 7. 11. 2. 5. 3. An Introduction to DL/I Data Bases DL/I Programs and Control Blocks COBOL Basics for Processing a DL/I Data Base Segment Search Arguments : How to use them Data retrieval from an IMS Data Base Adding and Updating Data to a Data Base Secondary Indexing Logical Data Bases Recovery and Restart DL/I Data Base Organizations Advanced DL/I features
Page : 4/128
. 10. 8.Course Outline
MVS Quick Ref Ver.References
IMS for the COBOL Programmer
Part 1: Data base processing with IMS/VS and DL/I DOS/VS By Steve Eckols
IBM Redbooks : IMS Primer
By Rick Long. Mark Harrington.5
Page : 5/128
. Robert Hain. 5.
Module 1 An Introduction to DL/I Data Bases
Hierarchical Structures Why a Data Base Management System Basic DL/I Terminology Basic DL/I Data Base Processing
Page : 6/128
In a DL/I data base.1 A hierarchical structure
DL/I supports hierarchies that are difficult to implement with standard files. Some data elements are dependent on others.
Page : 7/128
Fig 1. data elements are organized in a hierarchical structure.
Why a data base management system?
01 VENDOR-RECORD. PIC X(6).2. PIC X(5).b Record layout for the Inventory Master data set Fig 1. PIC X(35).
Fig 1. PIC S9(7) COMP-3. X(10). PIC X(3). X(30). 10 IR-VENDOR-CODE 10 IR-NUMBER 05 IR-DESCRIPTION 05 IR-UNIT-PRICE 05 IR-AVG-UNIT-COST 05 IR-LOCATION-QUANTITY-DATA OCCURS 10 IR-LOCATION 10 IR-QUANTITY-ON-HAND 10 IR-REORDER-POINT 10 IR-QUANTITY-ON-ORDER 10 IR-LAST-REORDER-DATE
PIC X(3). X(30). XX.
Fig 1. PIC S9(5)V99 COMP-3. X(17). 20 TIMES. PIC S9(5)V99 COMP-3.2. 05 VR-VENDOR-CODE 05 VR-VENDOR-NAME 05 VR-VENDOR-ADDRESS 05 VR-VENDOR-CITY 05 VR-VENDOR-STATE 05 VR-VENDOR-ZIP-CODE 05 VR-VENDOR-TELEPHONE 05 VR-VENDOR-CONTACT
PIC PIC PIC PIC PIC PIC PIC PIC
X(3).2 Record layouts that illustrate a hierarchical structure
Page : 8/128
. PIC S9(7) COMP-3. X(30). PIC S9(7) COMP-3. 05 IR-ITEM-KEY.a Record layout for the VENDORS data set
it¶s part of the data base¶s definition.3 The ADDRESS segment with six fields
A category of data There can be a maximum of 255 segment types and 15 levels in one data base
One specific segment of a particular type containing user data
Note:Within a data base there is only one of each segment type. Consists of one or more fields ADDRESS
House Number Street Name City State Country Zip Code
Fig 1.Basic DL/I Terminology
A grouping of data The unit of data that DL/I transfers to and from your program in an I/O operation. The word µsegment¶ is used to mean either µsegment type¶ or µsegment occurrence¶ and usually the meaning is clear from the context Page : 9/128
.but there can be an unlimited number of occurrences of each segment type.
S9(5)V99 COMP-3. X (17). X(35).
Fig 1. X(10). 05 IVS-VENDOR-CODE 05 IVS-VENDOR-NAME 05 IVS-VENDOR-ADDRESS 05 IVS-VENDOR-CITY 05 IVS-VENDOR-STATE 05 IVS-VENDOR-ZIP-CODE 05 IVS-VENDOR-TELEPHONE * 01 INVENTORY-ITEM-SEGMENT.
PIC PIC PIC PIC
X(5). S9(7) COMP-3. 05 ISLS-LOCATION 05 ISLS-QUANTITY-ON-HAND 05 ISLS-REORDER-POINT 05 ISLS-QUANTITY-ON-ORDER * the Inventory data base with three segment types
PIC PIC PIC PIC PIC PIC PIC X(3). X(30).)
Stock Location Fig 1. X(9). S9(7) COMP-3.5 Segment layouts for the Inventory data base
Page : 10/128
PIC PIC PIC PIC
X(3). S9(5)V99 COMP-3. S9(7) COMP-3.4 The hierarchical structure of * 01 INVENTORY-VENDOR-SEGMENT. 05 IIS-NUMBER 05 IIS-DESCRIPTION 05 IIS-UNIT-PRICE 05 IIS-AVG-UNIT-COST * 01 INVENTORY-STOCK-LOC-SEGMENT. XX.Basic DL/I Terminology (contd. X(30).
although it may have any number of subordinate segment occurrences
Vendor 1 Vendor 2
Item 2 Item 1
Item 1 Data base Record 2
Loc 2 Data base Record 1 Loc 5 Loc 4 Loc 3 Loc 2 Loc 1 Loc 1
Loc 2 Loc 1
Fig 1.6 Two data base records from the Inventory data base
Page : 11/128
.Basic DL/I Terminology (contd.)
The segment type at the top of a hierarchy
Data base record
Each occurrence of the root segment plus all the segment occurrences that are subordinate to it make up one data base record Every data base record has one and only one root segment.
Basic DL/I Terminology (contd.intermediate levels can¶t be skipped
Page : 12/128
A segment other than the root segment in a data base record Accessible only through one or more ³parent´ segments
A segment that has one or more dependent segments
Every dependent segment in a hierarchy
Two or more segment occurrences of the same type and with the same segment occurrence as their parent
Series of segments leading from the root segment occurrence down to any specific segment occurrence Must be continuous.
key field uniquely identifies the record
Additional Search fields
Used to search through the DB for particular values Max 255 search fields in a segment
Key formed to access a particular segment Concatenation of keys of root segment and all successive children down to the accessed segment
Fields not defined to IMS Format determined by the program loading the DB
Page : 13/128
Key or Sequence Field
The field DLI uses to maintain segments in ascending sequence Only a single field within a segment Segments need not necessarily require a key field If in a root segment.Basic DL/I Terminology (contd.
Logical data bases
Additional relationships within one physical data base
Fig 1. Likewise.7 A logical relationship can connect two data bases
In Fig 1.Basic DL/I Terminology (contd. the line item segment is the logical child segment (or just logical child) of the item segment.7. the item segment is the logical parent segment (or just logical parent) of the line item segment
Page : 14/128
Basic DL/I Data Base Processing
Top ±> Down. Position reflects not only on retrieved segments. Left -> Right Position
At any point.8 Sequential processing Loc 1
Loc 2 Loc 1
Page : 15/128
. but on new segments inserted as well
Item 2 Item 1
Item 1 Data base Record 2
Loc 2 Data base Record 1 Loc 5 Loc 4 Loc 3 Loc 2 Loc 1 Fig 1. a program has a position in the data base.
Item 2 Item 1
Item 1 Data base Record 2
Loc 2 Data base Record 1 Loc 5 Loc 4 Loc 3 Loc 2 Loc 1 Loc 1
Loc 2 Concatenated Key: Loc 1 Vendor 2 Item 1 Location 1
Fig 1.9 Random Processing
Page : 16/128
.Basic DL/I Data Base Processing (contd.)
Random (Direct) Processing
Key (sequence) field required Concatenated Key
Completely identifies the path from the root segment to the segment you want to retrieve.
Module 2 DL/I Programs and Control Blocks
The IMS Software Environment How DL/I relates to your application programs Control Blocks DBDGEN PSBGEN IMS Processing Options ACB & ACBGEN Running an application program under DL/I
Page : 17/128
The IMS Software Environment
IMS Control Blocks
Fig 2.1 The IMS Software Environment
Page : 18/128
How DL/I relates to your application programs
Standard File Processing DL/I Data Base Processing
Operating System Access Method (eg. VSAM)
Operating System Access Method (eg.2 Standard file processing compared to DL/I data base processing
Page : 19/128
File Data Set
Data Base Data Set
Interface between application program and the access method CALL statement to invoke DL/I Parameters passed by the CALL tell DL/I what operation to perform DL/I invokes a standard access method.How DL/I relates to your application programs (contd.
Page : 20/128
Standard file processing
Standard COBOL statements (like READ / WRITE) invoke the appropriate access method (like VSAM) Format of the record as processed by the program should be the same as the format of the record in the file
DL/I data base processing
DLI .usually VSAMto store data base data on disk Format of records in a data base data set need not match the layouts of the segments that make up the data base The way the program sees the data base is different from the way the access method sees it.
Data elements a program can ³see´ in those data bases The processing a program can do with the data elements
Application programs that have similar data base processing requirements can share a PSB
Data Base Administrator (DBA) has to create DL/I control blocks DBDGEN and PSBGEN Control Statements
Page : 21/128
Physical structure of a DL/I data base isn¶t specified in an application program DL/I uses a set of control blocks(DBDs and PSBs) to define a data base¶s structure Data Base Descriptor (DBD)
Describes the complete structure of a data base A unique DBD for each DL/I data base
Program Specification Block (PSB)
Application program¶s view of the Database PSB Specifies
Data bases (one or more) a program can access.
SAMPLE DBDGEN (Explained in next slide)
STMT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 72 73 74 75 76 77 78 79 80 162 211 325 326 SOURCE STATEMENT PRINT NOGEN DBD NAME=INDBD.START=1.TYPE=P FIELD NAME=INLOCROP.3 Assembler source listing for the Inventory data base DBDGEN
Page : 22/128
.DEVICE=3380 **/ 3380 DISK STORAGE * SEGM NAME=INVENSEG.BYTES=4.BYTES=4.BYTES=9.ACCESS=HIDAM DATASET DD1=IN.TYPE=P FIELD NAME=INLOCONO.INPXDBD).BYTES=131 LCHILD NAME=(INPXPNTR.TYPE=C FIELD NAME=INVENNAM.BYTES=48 FIELD NAME=(INITMNUM. PARENT=0. PARENT=INITMSEG.START=4.BYTES=17.BYTES=3.START=34.TYPE=C FIELD NAME=INITMPRC.TYPE=P FIELD NAME=INITMCST.BYTES=3.SEQ).BYTES=30.2041) **/* COUNTERINTERVALSIZE (2048)) **/* *NOTE2 .TYPE=P FIELD NAME=INLOCDAT.TYPE=C FIELD NAME=INVENCIT.POINTER=INDX FIELD NAME=(INVENCOD.TYPE=C FIELD NAME=INVENSTA.BYTES=6.TYPE=C FIELD NAME=INITMDES.BYTES=10.START=41.PARENT=INVENSEG.BYTES=5.TYPE=C FIELD NAME=INVENTEL.BYTES=4.BYTES=4.SEQ).START=64.START=92.START=1.BYTES=30.TYPE=C * DBDGEN **/************************************************************************** **/ RECOMMENDED VSAM DEFINE CLUSTER PARAMETERS **/************************************************************************** **/* *NOTE2 **/* DEFINE CLUSTER (NAME(IN) NONINDEXED **/* RECORDSIZE (2041.START=83.START=12.START=4.TYPE=C * SEGM NAME=INITMSEG.TYPE=C FIELD NAME=INLOCONH.TYPE=P * SEGM NAME=INLOCSEG.BYTES=4.START=1.BYTES=30.START=45.START=16.BYTES=35.START=102.START=81.BYTES=2.TYPE=C FIELD NAME=INVENCON.POINTER=TB.SHOULD SPECIFY DSNNAME FOR DD IN **/************************************************************************** **/***********SEQUENCE FIELD************* **/***********SEQUENCE FIELD************* FINISH END
Fig 2.TYPE=C FIELD NAME=INVENZIP.START=8.BYTES=21 FIELD NAME=(INLOCLOC.SEQ).START=6.TYPE=C FIELD NAME=INVENADR.
SAMPLE DBDGEN (contd.3
First macro ± DBD ± identifies the data base and specifies the DL/I access method Second macro ± DATASET.)
Explanation of Fig 2.identifies the file that would contain the data base Symbolic name (IN) identifies the data set in the JCL at execution time Segment types are defined using the SEGM macro Segment hierarchical relationships are specified by the PARENT parameter on a SEGM macro
PARENT= 0 or absence of PARENT parameter specifies root segment
POINTER parameter and LCHILD macro are needed for HIDAM Databases Only search fields need be specified in the DB
Page : 23/128
4 FIELD macro TYPE parameter codes
SEQ parameter specifies a sequence field
segment occurrences are added in sequence by values in these fields
Page : 24/128
FIELD macro defines a field in the DB
START NAME LENGTH TYPE position of field within segment name of the field length of the field data type of the field
FIELD Macro TYPE Codes C P Z X H F
Data Type Character Packed decimal Zoned decimal Hexadecimal Half word Binary Full word Binary
Fig 2.DBDGEN (contd.
LANG=COBOL 87 END Fig 2.PROCOPT=LS 3 SENSEG NAME=INVENSEG 4 SENSEG NAME=INITMSEG.SAMPLE PSBGEN
STMT SOURCE STATEMENT 1 PRINT NOGEN 2 PCB TYPE=DB.PARENT=INVENSEG 5 SENSEG NAME=INLOCSEG. the program has access to all fields
Field level sensitivity
When the program accesses that segment.5
PCB (Program Communication Block) refers to one data base. only sensitive fields are presented
Page : 25/128
.5 Assembler source listing for the Inventory data base load program¶s PSBGEN
Explanation of Fig 2.PARENT=INITMSEG 6 PSBGEN PSBNAME=INLOAD.DBDNAME=INDBD. One PCB macro for each database accessed Segment Level Sensitivity
A program¶s access to parts of the data base identified at the segment level Within sensitive segments.
Page : 26/128
. subordinate SENSEG macros identify the sensitive segments in the data base Names specified in the SENSEG macros must be segment names from the DBDGEN for the data base named in the DBDNAME parameter of the PCB macro PSBGEN macro
Indicates that there are no more statements in the PSBGEN job PSBNAME parameter specifies the name to be given to the output PSB module LANG parameter specifies the language in which the related application program will be written.)
DBDNAME parameter on the PCB macro specifies the name of the DBD KEYLEN parameter specifies the length of the longest concatenated key the program can process in the data base PROCOPT parameter specifies the program¶s processing options For each PCB macro.PSBGEN (contd.
it should be empty prior to the load
The PROCOPT given for a Sensitive segment would override the one given for the DB
Example : PCB TYPE=DB.NAME=LDB42F. KEYLEN=200 SENSEG NAME=SEGL4201. PARENT=0. If VSAM DB.PROCOPT=A WARNING : Indiscriminate use of PROCOPTS can lead to inexplicable results !
Page : 27/128
.IMS Processing Options
Indicates to IMS the type of access allowed for a sensitive segment (SENSEG) Commonly used Processing Options
PROCOPT=G means only read-only access PROCOPT=R means read/replace access PROCOPT=I means insert access allowed PROCOPT=D means Read/Delete access PROCOPT=A means all the above options present For GSAM DBs PROCOPT=LS for output and GS (Get Sequential) for input PROCOPT=L allows a 'load' into the DB.PROCOPT=G.
ACB & ACBGEN
ACB(Application Control Blocks) : It is created by merging and expanding PSB¶s and DBD¶s into an IMS internal format when an application program is scheduled for execution. ACB¶s save instruction. ACBGEN : The process of building ACB is called Block Building and is done by means of ACBGEN. ACB¶s can be prebuild for PSB¶s that reference GSAM databases. ACB¶s are maintained in IMS.ACBLIB library. execution and direct-access wait time and improves performance in application scheduling. IMS can build ACB¶s either dynamically or it can prebuild them using ACB maintenance utility.
Page : 28/128
. ACB¶s cannot be prebuilt for GSAM DBD¶s.
// MSGCLASS=Z. // PARM='DLI.'PGMR NAME'.RESLIB.PROGRAM. // NOTIFY=&SYSUID //JOBLIB DD DSN=YOUR. // DISP=SHR // DD DSN=YOUR.LOADPSB'
Page : 29/128
.LOAD. // DISP=SHR //PROC EXEC PROCNAME.SYSTEM. SYMBOLIC PARAMETERS //********************************************************* //PROCNAME PROC //******************************************************** //* THIS PROC LOADS AN IMS VSAM DATABASE //* A PROGRAM 'LOAD' IS USED FOR THIS PURPOSE //* THE PSB USED FOR LOADING IS LOADPSB //******************************************************** //LOAD EXEC PGM=DFSRRC00. // CLASS=J.LIBRARY.LIBRARY.LOAD.Running an application program under DL/I
Batch program does not access IMS directly JCL invokes the DL/I µbatch initialization module¶ DFSRRC00 which loads the application program and the required DL/I modules The program and DL/I modules execute together Sample JCL :
//JOBNAME JOB (ACCT).
DATASET.DATA. // DISP=SHR //CPXMOPTS DD DSN=PARMLIB.IEFRDER.DFRESLIB.LIBRARY. // DISP=SHR // DD DSN=YOUR.USED. // DISP=SHR //IMSLOGR DD DSN=YOUR.LOADING.LIBRARY. // DISP=SHR //IEFRDER DD DSN=YOUR.DBD.PART.SAMPLE JCL (Contd.DATASET. // DISP=SHR //CPXMRPTS DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //IMSERR DD SYSOUT=* //IMSPRINT DD SYSOUT=*
Page : 30/128
//DFSRESLB DD DSN=YOUR.PART.FOR.DISP=SHR //INDEX DD DSN=VSAMDB.INDEX.DISP=SHR //INPUT DD DSN=FILE. // DISP=OLD //* DD NAMES ARE AS SPECIFIED IN THE DATABASE //DATA DD DSN=VSAMDB. // DISP=SHR //IMS DD DSN=YOUR.IMSRLOG. // DISP=SHR //DFSVSAMP DD DSN=IMSVS.LIBRARY(LOAD).PSB.LIBRARY.PROCLIB(DFSVSAMP).
Module 3 COBOL Basics for Processing a DL/I Data Base
The ENTRY and GO BACK Statements The DL/I Call The PCB Mask
Page : 31/128
ENTRY and GO BACK Statements
ENTRY µDLITCBL¶ USING PCB-name1 [PCB-name2..1 Format of the DL/I ENTRY Statement
Application program is invoked under the control of the batch initialization module DLITCBL => µDL/I to COBOL¶ is the entry point to the program DL/I supplies the address of each PCB defined in the program¶s PSB PCBs must be defined in the Linkage Section Linkage Section definition of a PCB is called a µPCB Mask¶ Addressability to PCBs established by listing the PCB Masks on the ENTRY statement
PCB masks should be listed on the ENTRY statement in the same sequence as they appear in your program¶s PSBGEN GO BACK Statement
When a program ends. it passes control back to the DL/I DL/I reallocates resources and closes the data base data sets Use GO BACK and not a STOP RUN statement
Page : 32/128
among other things. the operation you want DL/I to perform
CALL µCBLTDLI¶ USING
DLI-function PCB-mask segment-io-area [segment-search-argument(s)]
Fig 3. ASMTDLI are other options
Page : 33/128
.The DL/I Call
CALL statements are used to request DL/I services Parameters you code on the CALL statement specify. is an interface module that is link edited with your program¶s object module PLITDLI.2 Format of the DL/I call
CBLTDLI => µCOBOL to DL/I¶.
µDLET¶. µGHNP¶. µCHKP¶. µGN ¶. µGNP ¶. µREPL¶.The DL/I Call (contd. µGHU ¶.)
The DL/I Function
First parameter coded on any DL/I call Four character working storage field containing the function code
01 DLI-FUNCTIONS. µISRT¶. 05 DLI-GU 05 DLI-GHU 05 DLI-GN 05 DLI-GHN 05 DLI-GNP 05 DLI-GHNP 05 DLI-ISRT 05 DLI-DLET 05 DLI-REPL 05 DLI-CHKP 05 DLI-XRST 05 DLI-PCB
Fig 3. µGHN ¶. µXRST¶. µPCB ¶.
COBOL doesn¶t allow coding literals in a CALL statement
Page : 34/128
.3 DL/I function codes
PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC
X(4) X(4) X(4) X(4) X(4) X(4) X(4) X(4) X(4) X(4) X(4) X(4)
VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE
The DL/I Call (contd. but only subordinate to an established parent segment The three get function codes that contain an H are µget hold functions¶ and are used to specify an intent to update a segment after you retrieve it GHU or the µget hold unique¶ function corresponds to GU GHN or the µget hold next¶ function corresponds to GN GHNP or the µget hold next within parent¶ function corresponds to GNP
Used to change data in the data base ISRT or the µinsert¶ function is used to add a new segment occurrence to a data base± whether it be change an existing data base or to load a new one DLET or the µdelete¶ function is used to remove a segment from a data base REPL or the µreplace¶ function is used to replace a segment occurrence
Page : 35/128
First six 05-level items in Fig 3.3 Used to retrieve segments from a DL/I data base GU µget unique¶ function causes DL/I to retrieve a specific segment occurrence based on field values that you specify GN µget next¶ function used to retrieve segment occurrences in sequence GNP µget next within parent¶ function lets you retrieve segment occurrences in sequence.
Functions CHKP (the µcheckpoint¶ function) and XRST (the µrestart¶ function) are used in programs to take advantage of IMS¶s recovery and restart features Function PCB is used in CICS programs Function SYNC is used for releasing resources that IMS has locked for the program (applicable only in a BMP) Function INIT allows an application to receive status codes regarding deadlock and data availability (from DB PCBs)
Page : 36/128
.The DL/I Call (contd.
The DL/I Call (contd.)
Second parameter on the DL/I call The name of the PCB mask defined in the program¶s Linkage Section ENTRY statement establishes a correspondence between PCB masks in the Linkage Section and the PCBs within the program¶s PSB After each DL/I call. which the programmer can use to determine whether the call succeeded or failed
Segment I/O Area
Third parameter on the DL/I call Name of the working storage field into which DL/I will return retrieved data or from which it will get data for an update operation
Page : 37/128
. DL/I stores a status code in the PCB mask.
The DL/I Call (contd.)
Segment search argument
Optional parameter on the DL/I call Identifies the segment occurrence you wish to access Multiple SSAs on a single DL/I call Two kinds of SSAs± unqualified and qualified An unqualified SSA
Supplies the name of the next segment type that you want to operate on If you issue a GN call with an unqualified SSA. DL/I will return the next occurrence of the segment type you specify
A qualified SSA
Combines a segment name with additional information that specifies the segment occurrence to be processed A GU call with a qualified SSA might request a particular occurrence of a named segment type by providing a key value
Page : 38/128
COMP. X(4). XX.The PCB Mask
For each data base your program accesses. DL/I maintains an area of storage called the program communication block (PCB) Masks are defined for those areas of storage in the Linkage Section of your program
01 INVENTORY-PCB-MASK.4 PCB mask for an Inventory data base
Page : 39/128
COMP. 05 IPCB-DBD-NAME 05 IPCB-SEGMENT-LEVEL 05 IPCB-STATUS-CODE 05 IPCB-PROC-OPTIONS 05 FILLER 05 IPCB-SEGMENT-NAME 05 IPCB-KEY-LENGTH 05 IPCB-NUMB-SENS-SEGS 05 IPCB-KEY PIC PIC PIC PIC PIC PIC PIC PIC PIC X(8). COMP. S9(5) S9(5) X(11). S9(5) X(8).
Data base name
The name of the data base being processed
Specifies the current segment level in the data base After a successful call. DL/I stores the level of the segment just processed in this field
Contains the DL/I status code When DL/I successfully completes the processing you request in a call. it indicates that to your program by moving spaces to the status code field in the PCB If a call is unsuccessful or raises some condition that isn¶t normal.
Page : 40/128
.The PCB Mask (contd. DL/I moves some non-blank value to the status code field It is good programming practice to evaluate the status code after you issue a DL/I call
Processing options (would be elaborated later)
Indicates the processing a program is allowed to do on the data base
Segment name feedback area
The name of the segment is stored by DL/I in this field after each DL/I call.
Key length feedback area
The field DL/I uses to report the length of the concatenated key of the lowest level segment processed during the previous call Used with the key feedback area
Number of sensitive segments
Contains the number of SENSEG macros subordinate to the PCB macro for this data base
Key feedback area
Varies in length from one PCB to another As long as the longest possible concatenated key that can be used with the program¶s view of the data base After a data base operation. and it returns the key¶s length in the key length feedback area
Page : 41/128
.The PCB Mask (contd. DL/I returns the concatenated key of he lowest level segment processed in this field.
Module 4 Segment Search Arguments
Types of SSAs Basic Unqualified SSA Basic Qualified SSA Command Codes The Null Command Code Path Call Multiple Qualifications
Page : 42/128
you often have to specify several levels of SSAs to access a segment at a low level in a data base You can code as many SSAs on a single call as you need You can combine qualified and unqualified SSAs on a single call
Page : 43/128
. but also a specific occurrence of it
Includes a field value DL/I uses to search for the segment you request Any field to which the program is sensitive to can be used in an SSA
Because of the hierarchical structure DL/I uses.Types of SSAs
SSA identifies the segment occurrence you want to access It can be either
An unqualified SSA simply names the type of segment you want to use A qualified SSA specifies not only the segment type.
Basic Unqualified SSA
01 UNQUALIFIED-SSA. PIC X VALUE SPACE. * 05 UNQUAL-SSA-SEGMENT-NAME 05 FILLER *
Fig 4.1 A basic unqualified SSA
PIC X(8). you must pad it on the right with blanks The ninth position of a basic unqualified SSA always contains a blank
The DL/I uses the value in position 9 to decide what kind of SSA you are providing
Page : 44/128
A basic unqualified SSA is 9 bytes long The first eight bytes contain the name of the segment you want to process If the segment name is less than eight characters long.
01 UNQUAL-VENDOR-SSA PIC X(9) VALUE µINVENSEG ¶.Basic Unqualified SSA (contd. you can code the segment name as a literal when you define a qualified SSA
MOVE µINVENSEG¶ TO UNQUAL-SSA-SEGMENT-NAME MOVE µINITMSEG¶ TO UNQUAL-SSA-SEGMENT-NAME
Alternatively. by moving an appropriate eight-character segment name to the field UNQUAL-SSA-SEGMENT-NAME For example. you must modify the segment name during program execution.
Page : 45/128
. * 01 UNQUAL-ITEM-SSA PIC X(9) VALUE µINITMSEG ¶. * 01 UNQUAL-STOCK-LOC-SSA PIC X(9) VALUE µINVENSEG ¶.)
To access a particular segment type.
X(3).2 A basic qualified SSA
A qualified SSA lets you specify a particular segment occurrence based on a condition that a field within the segment must meet The first eight characters of a basic qualified SSA is the eight character segment name The ninth byte is a left parenthesis Immediately following the left parenthesis in positions 10 through 17 is an eight character field name
Page : 46/128
. 05 05 05 05 FILLER FILLER VENDOR-SSA-CODE FILLER PIC PIC PIC PIC X(9) VALUE µINVENSEG(¶. X(10) VALUE µINVENCOD =¶.Basic Qualified SSA
Fig 4. X VALUE µ)¶.
you code a two-character relational operator to indicate the kind of checking DL/I should do on the field in the segment
The qualified SSA relational operators are shown below ( stands for a single blank space)
Equal to Not equal to Greater Than Greater than or Equal to Less Than Less than or Equal to EQ NE GT GE LT LE = <> > >= < <= = > => < =<
After the relational operator. you code a variable field into which you move the search value you want to use for the call The length of the search value field can vary depending on the size of the field in the segment± it is the only part of a basic qualified SSA that doesn¶t have a fixed length The last character in the qualified SSA is a right parenthesis
Page : 47/128
After the field name. in positions 18 and 19.Basic Qualified SSA (contd.
4 Qualified SSA format with a single command code
Command are used in SSAs for three purposes
To extend DL/I functionality To simplify programs by reducing the number of DL/I calls For performance improvement resulting from the reduced number of DL/I calls
Page : 48/128
Fig 4.3 Unqualified SSA format with a single command code
X VALUE SPACE.
Page : 49/128
. * 05 UNQUAL-SSA-SEGMENT-NAME 05 FILLER 05 UNQUAL-SSA-COMMAND-CODE 05 FILLER *
PIC PIC PIC PIC
X(8).Command Codes (contd.)
To use command codes. code an asterisk in position 9 of the SSA Then code your command codes starting from position 10. DL/I considers all characters to be command codes until it encounters a space (for an unqualified SSA) or a left parenthesis (for a qualified SSA) It is unusual to use more than one command code in a single SSA A basic unqualified SSA with a single variable command code is shown below
01 UNQUALIFIED-SSA. X VALUE ³*´. X. it knows command codes will follow From position 10 onwards. When DL/I finds an asterisk in position 9.
5 SSA Command Codes
Page : 50/128
Command Code C D F L N P Q U V
Meaning Concatenated Key Path Call First Occurrence Last Occurrence Path Call Ignore Set Parentage Enqueue Segment Maintain position at this level Maintain position at this and all superior levels Null command code
Fig 4.Command Codes (contd.
DL/I ignores it Particularly useful if you would like to use the same SSA with and without command codes An SSA with the null command code is shown below
01 UNQUALIFIED-SSA. X VALUE ³*´.The Null Command Code
Value is a hyphen (±) Although command code position is present. X VALUE SPACE. X VALUE ³-´.
Page : 51/128
. * 05 UNQUAL-SSA-SEGMENT-NAME 05 FILLER 05 UNQUAL-SSA-COMMAND-CODE 05 FILLER *
PIC PIC PIC PIC
If path call is not explicitly enabled in the PSBGEN job there will be an 'AM' status code.Path Call
A DB call with an SSA that includes the 'D' Command code is a "PATH CALL³ . DL/I operates on the lowest level segment that is specified in an SSA(STOCK-LOC-SSA in the above E.) In case if we need data from not just from the lowest level but from other levels as well we normally have to give 3 separate GU calls.
Page : 52/128
.This will reduce the efficiency of the program Such a call operates on two or more segments rather than just one segment. If a program has to use "Path call" then "P" should be one of the values specified in the PROCOPT parameter of the PCB in the programs PSBGEN.g. It¶s a facility where in we can retrieve an entire path of the segment Consider a sample GU call
CALL 'CBLTDLI' USING DLI-GU INVEN-PCB-MASK INVEN-STOCK-LOC-SEG VENDOR-SSA ITEM-SSA STOCK-LOC-SSA
To connect them. you connect two or more qualification statements (a field name. a relational operator.Multiple Qualifications
There are two cases in which you would use multiple qualification
When you want to process a segment based on the contents of two or more fields within it When you want to process a segment based on a range of possible values for a single field
To use multiple qualification. and a comparison value) within the parentheses of the SSA. you use the Boolean operators AND and OR Either of the two symbols shown in the table below may be used for AND or OR The independent AND operator is used for special operations with secondary indexes and will be discussed later
Page : 53/128
which uses multiple qualifications can be used to retrieve vendor segments whose vendor codes fall within a certain range
The first qualification statement specifies that the vendor code field must be greater than or equal to a particular value.
The above SSA. X X(10) X(3). VALUE µ&¶. VALUE µ)¶.Multiple Qualifications (contd.)
01 VENDOR-SSA. * 05 FILLER 05 FILLER 05 VENDOR-SSA-LOW-CODE 05 FILLER 05 FILLER 05 VENDOR-SSA-HIGH-CODE 05 FILLER
PIC PIC PIC PIC PIC PIC PIC
X(9) X(10) X(3). that is the high end of the range To retrieve segments that fall within this range. you would first move values for low and high ends of the range to VENDOR-SSA-LOW-CODE and VENDOR-SSA-HIGH-CODE Then you would execute GN calls that include VENDOR-SSA
Page : 54/128
. VALUE µINVENCOD<=¶. X
VALUE µINVENSEG(¶. that is the low end of the range The second qualification statement specifies that the vendor code field must be less than or equal to a particular value. VALUE µINVENCOD>=¶.
Module 5 Retrieving Data from a Data Base
The GU Call The GN Call The GNP Call Status Codes Expected during Sequential Processing Using Command Codes with Retrieval Calls Multiple Processing
Page : 55/128
wherein a complete set of qualified SSAs to retrieve a segment. includes one for each level in the hierarchical path to the segment you want to retrieve is called a µfully qualified call¶
Page : 56/128
A typical GU call like the one above.The GU Call
Used for random processing Applications of random processing
When a relatively small number of updates are posted to a large data base To establish position in a data base for subsequent sequential retrieval
You know what data you want to retrieve and you want to get to it directly Independent of the position established by the previous calls
CALL µCBLTDLI¶ USING DLI-GU INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT VENDOR-SSA ITEM-SSA STOCK-LOCATION-SSA.
When you use an unqualified SSA in a GU call. DL/I returns the first segment occurrence with the specified search value
Special considerations for GU calls without a full set of qualified SSAs
1. If you issue a GU call without any SSAs. the action DL/I takes depends on your current position and on the SSAs that are missing
DL/I either uses the established position or defaults to an unqualified SSA for the segment
Recommended style of coding
Code a qualified or unqualified SSA for each level in the path from the root segment to the segment you want to retrieve
Page : 57/128
. for some applications you may find it necessary to either
Access a segment whose sequence field allows nonunique values Access a segment based on a field that is not the segment¶s key field In the above cases. DL/I returns the first occurrence of the root segment in the data base 3. GU processing is based on sequence (key) fields with unique values However. DL/I accesses the first segment occurrence in the data base that meets the criteria you specify 2.)
Usually.The GU Call (contd. If you omit some SSAs for intermediate levels in a hierarchical path.
Status codes you can expect during random processing with GU calls
Only two status code values need to be considered± spaces and GE Spaces means the call was successful and the requested segment was returned in your program¶s segment I/O area A GE status code indicates that DL/I couldn¶t find a segment that met the criteria you specified in the call
Page : 58/128
.The GU Call (contd.
if it does not employ an SSA).
Used for basic sequential processing After any successful data base call.The GN Call
CALL µCBLTDLI¶ USING DLI-GN INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT STOCK-LOCATION-SSA. DL/I allows any occurrence of that segment type to satisfy the call But when you specify a qualified SSA. in hierarchical sequence If a GN call includes SSAs± qualified or unqualified± DL/I retrieves only segments that meet requirements of all SSAs you specify If you include an unqualified SSA or omit an SSA altogether for a segment type. position is before the root segment of the first data base record The GN call moves forward through the data base from the position established by the previous call If a GN call is unqualified (that is. DL/I selects only those segment occurrences that meet the criteria you specify
Page : 59/128
. your data base position is immediately before the next segment occurrence in the normal hierarchical sequence Before your program issues any calls. it returns the next segment occurrence in the data base regardless of type.
and the call must be successful
Parentage is never automatically established. your program MUST issue either a GU call or a GN call. except it retrieves only segments that are subordinate to the currently established parent To establish parentage. in spite of the hierarchical structure of the data base
The segment returned by the call becomes the established parent Subsequent GNP calls return only segment occurrences that are dependent on that parent When there are no more segments within the established parentage DL/I returns GE as the status code
Page : 60/128
Used for sequential processing within parentage Works like the GN call.The GNP Call
CALL µCBLTDLI¶ USING DLI-GNP INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT UNQUALIFIED-SSA.
The GNP Call (contd.1 Sequential retrieval with GNP call Loc 5 Loc 4 Loc 3 Loc 2 Loc 1
Page : 61/128
Item 2 Established Parent Item 1
Loc 2 Loc 1 Established Vendor 1 Parent
Loc 5 Loc 4 Loc 3 Loc 2 Loc 1 Item 1
Loc 2 Loc 1 Fig 5.
Status Codes you can expect during Sequential Processing
Page : 62/128
the call processes the last occurrence of the segment named by the SSA. subject to the call¶s other qualifications Can be used when you are doing sequential processing and you need to back up in the data base. the F command code can be used for sequential retrieval using GN and GNP calls Meaningless with GU calls. but in many cases. the call processes the first occurrence of the segment named by the SSA.Using Command Codes with Retrieval Calls
The F command code
When you issue a call with an SSA that includes the F command code. but from other levels as well Makes it easy to retrieve an entire path of segments
Page : 63/128
. you want data not just from the lowest level in the call. subject to the call¶s other qualifications
The D command code
Used to retrieve more than one segment occurrence using just one call Normally DL/I operates on the lowest level segment you specify in an SSA. because GU normally retrieves the first segment occurrence that meets the criteria you specify
The L command code
When you issue a call with an SSA that includes the L command code. or in other words.
. 05 VENDOR-SSA-CODE PIC X(3). 05 FILLER PIC X VALUE ³)´. 05 ITEM-SSA-NUMBER PIC X(5). 05 FILLER PIC X(11) VALUE ³INITMSEG*D(´. * CALL ³CBLTDLI´ USING DLI-GU INVENTORY-PCB-MASK PATH-CALL-I-O-AREA VENDOR-SSA ITEM-SSA LOCATION-SSA.Using Command Codes with Retrieval Calls (contd. . 05 LOCATION-SSA-CODE PIC X(3). 05 FILLER PIC X VALUE ³)´. 05 FILLER PIC X(10) VALUE ³INLOCLOC =´.
Page : 64/128
. * 01 LOCATION-SSA. 05 INVENTORY-VENDOR-SEGMENT PIC X(131). * 01 PATH-CALL-I-O-AREA.)
The usage of the D command code is illustrated below
01 VENDOR-SSA. 05 FILLER PIC X(10) VALUE ³INVENCOD =´. * . 05 INVENTORY-STOCK-LOC-SEGMENT PIC X(21). 05 FILLER PIC X(11) VALUE ³INVENSEG*D(´. * 01 ITEM-SSA. 05 FILLER PIC X VALUE ³)´. 05 INVENTORY-ITEM-SEGMENT PIC X(48). 05 FILLER PIC X(10) VALUE ³INITMNUM =´. 05 FILLER PIC X(11) VALUE ³INLOCSEG*D(´.
rather than coding a field name. X(5). . . X(3).Using Command Codes with Retrieval Calls (contd. you don¶t have to code separate SSAs for each level in the hierarchical path Instead you can use a single SSA with the C command code Then. you specify the concatenated key for the segment you are interested in An illustration of the use of the C command code is shown below
* 01 LOCATION-SSA. * 05 FILLER 05 LOCATION-SSA-VENDOR 05 LOCATION-SSA-ITEM 05 LOCATION-SSA-LOCATION 05 FILLER * . relational operator.)
The C command code
If you are developing a program that retrieves just lowerlevel segment occurrences from a data base. CALL µCBLTDLI¶ USING
PIC PIC PIC PIC PIC
X(11) VALUE µINLOCSEG*C(µ.
DLI-GU INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT LOCATION-SSA. X VALUE µ)¶.
Page : 65/128
. and search value. X(3).
DL/I normally establishes parentage at the lowest level segment that is retrieved However.)
The P command code
When you issue a GU or GN call. if you want to override that and cause parentage to be established at a higher-level segment in the hierarchical path.Using Command Codes with Retrieval Calls (contd. DL/I restricts the search for the segment you request to dependents of the segments with the U command code Has the same effect as a call which contains a qualified SSA for the current position Is ignored if used with a qualified SSA
The V command code
Effect is same as coding the U command code at that level and all levels above it in the hierarchy Is ignored if used with a qualified SSA
Page : 66/128
. you can use the P command code in its SSA
The U command code
When you use an unqualified SSA that specifies the U command code in a GN call.
Using Command Codes with Retrieval Calls (contd. a segment or path of segments You only need to use the Q command code in an interactive environment where there is a chance that another program might make a change to a segment between the time you first access it and the time you are finished with it
Page : 67/128
The Q command code
This command code is used to enqueue. or reserve for exclusive use.
each has its own mask in the Linkage Section and is specified in the ENTRY statement It is up to the program¶s logic to decide when to use a particular PCB to access the data base This method for implementing multiple processing. Through multiple positioning
The DBA can define multiple PCBs for a single data base Then.Multiple Processing
Multiple processing is a general term that means a program can have more than one position in a single physical data base at the same time DL/I lets the programmer implement multiple processing in two ways
1. though flexible. the program has two (or more) views of the data base As with PCBs for different data bases. Through multiple PCBs 2. is inefficient because of the overhead imposed by the extra PCBs
Page : 68/128
Lets a program maintain more than one position within a data base using a single PCB To do that. DL/I maintains a distinct position for each hierarchical path the program processes Most of the time.2 Two data base records to illustrate multiple positioning
Page : 69/128
.Multiple Processing (contd. multiple positioning is used to access segments of two or more types sequentially at the same time
A1 Data base Record 1
C13 C12 B13 B12 B11 Data base Record 2 C22 B22 C11 A2
When you use multiple positioning.)
MOVE µSEGB ¶ TO UNQUAL-SSA-SEGMENT-NAME. MOVE µSEGC ¶ TO UNQUAL-SSA-SEGMENT-NAME. CALL µCBLTDLI¶ USING DLI-GN SAMPLE-DB-PCB SEGMENT-C-I-O-AREA UNQUALIFIED-SSA. DL/I maintains its separate positions based on segment type As a result you include an unqualified SSA in the call that names the segment type whose position you want to use It is the DBA who decides whether single or multiple positioning will be in effect in the program¶s PSB As a result multiple positioning is not the characteristic of the data base but instead.Multiple Processing (contd. CALL µCBLTDLI¶ USING DLI-GN SAMPLE-DB-PCB SEGMENT-B-I-O-AREA UNQUALIFIED-SSA. it¶s how DL/I allows a program to view a data base The same program can be processed with either single or multiple positioning by different programs The technique a program uses is determined by the program¶s PSB
Page : 70/128
Module 6 Adding and Updating Data to a Data Base
The ISRT Call The Get Hold Calls The REPL Call The DLET Call Common IMS Status Codes IMS Abends Sample IMS Program
Page : 71/128
DL/I tries to satisfy the call based on the current position in the data base As a result. you need to be careful about position when you issue an ISRT call that specifies only a single unqualified SSA
Page : 72/128
. either during update processing of an existing data base or during load processing of a new data base Before an ISRT call is issued.The ISRT Call
The ISRT call is used to add a segment occurrence to a data base. you issue the ISRT call with at least one SSA: an unqualified SSA for the segment type you want to add Consider the example below
CALL µCBLTDLI¶ USING DLI-ISRT INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT UNQUALIFIED-SSA. you should first build the segment occurrence by moving data to the fields of the segment description After formatting the segment.
Here UNQUALIFIED-SSA specifies the segment name Because the SSA is unqualified.
you can save system resources
Page : 73/128
. DL/I inserts the new segment occurrence in the correct position in the data base When you issue a fully qualified ISRT call like this. you can issue an ISRT call with qualified SSAs instead of first issuing GU calls to find out if higher-level segments in the path are present By issuing one call instead of two (or more). DL/I returns a status code of GE if any segment occurrence you specify in an SSA isn¶t present in the data base As a result.
If SSAs for vendor and item are initialized with the proper key values.)
A safer technique is to specify a qualified SSA for each hierarchical level above the one where you want to insert the segment. as illustrated below
CALL µCBLTDLI¶ USING DLI-ISRT INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT VENDOR-SSA ITEM-SSA UNQUALIFIED-SSA.The ISRT Call (contd.
or anywhere in the middle
For a segment with non-unique sequence fields.)
Where inserted segments are stored
If the new segment has a unique sequence field.The ISRT Call (contd. the new segment is added before any existing twins If the rule is ³last´. as most segment types do. it is added at the current position relative to existing twins. where the segment occurrence is added depends on the rules the DBA specifies for the data base For a segment without a sequence field. it is added in its proper sequential position However. the new segment is added after all existing twins If the rule is ³here´. which may be first. some lower-level segment types in some data bases have non-unique sequence fields or don¶t have sequence fields at all When that¶s the case. the rules are similar. last. but they determine where the new segment is positioned relative to existing twin segments that have the same key value
Page : 74/128
. the insert rule determines how the new segment is positioned relative to existing twin segments
If the rule is ³first´.
LC.The ISRT Call (contd.)
Status codes you can expect during insert processing
GE When you use multiple SSAs and DL/I cannot satisfy the call with the specified path
I I When you try to add a segment occurrence that is
already present in the data base For load processing you might get status codes LB.
In most cases they indicate that you are not inserting segments in exact hierarchical sequence That means there is an error in your program or the files from which you are loading the data base contain incorrect data
Page : 75/128
. LD or LE.
and. GHU (Get hold unique) 2. 3.The Get Hold Calls
There are three get hold functions you can specify in a DL/I call:
1. by retrieving the segment with one of these three calls Then you must issue the replace or delete call before you do another DL/I processing in your program
Page : 76/128
. you must declare your intent to do so. GHN (Get hold next). GHNP (Get hold next within parent)
These calls parallel the three retrieval calls earlier discussed Before you can replace or delete a segment.
You can¶t change the length of the segment 2. ADD TRANS-RECEIPT-QTY TO ISLS-QUANTITY-ON-HAND. CALL µCBLTDLI¶ USING DLI-REPL INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT. CALL µCBLTDLI¶ USING
Page : 77/128
. the call will fail An example of a typical replace operation is shown below
DLI-GHU INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT VENDOR-SSA ITEM-SSA LOCATION-SSA. You can¶t change the value of the sequence field (if the segment has one)
Never code a qualified SSA on an REPL call: if you do. you can make changes to the data in that segment.The REPL Call
After you have retrieved a segment with one of the get hold calls. then issue an REPL call to replace the original segment with the new data There are two restrictions on the changes you can make:
1. SUBTRACT TRANS-RECEIPT-QTY FROM ISLS-QUANTITY-ON-ORDER.
The REPL Call (contd. DL/I returns a DA status code
Page : 78/128
. you will get an AJ status code If your program issues a replace call without an immediately preceding get hold call.)
Status codes you can expect during replace processing
If you try to use a qualified SSA on an REPL call. DL/I returns a DJ status code If your program makes a change to the segment¶s key field before issuing the REPL call.
you¶d code a series of statements like the ones below
CALL µCBLTDLI¶ USING DLI-GHU INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT VENDOR-SSA ITEM-SSA LOCATION-SSA. DLI-DLET INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT. to delete a stock location that is no longer active. you automatically delete all segment occurrences subordinate to it The status codes you might get after a DLET call are the same as those you can get after an REPL call
Page : 79/128
.The DLET Call
The DLET call works much like REPL You must first issue a get hold call to indicate that you intend to make a change to the segment you are retrieving Then you issue a DLET call to delete the segment occurrence from the data base For example.
CALL µCBLTDLI¶ USING
Notice that the DLET call does not include any SSAs There is one important point you must keep in mind whenever you use the DLET call± when you delete a segment.
AJ. DJ DLET ± AB. II
AC ± Segment not found AD ± Wrong PCB used II -. GHU. GE. AC. AD.AB. AK. AD.Common IMS Status Codes
Returned by IMS after each DB call
Field STATUS-CODE X(02) in the PCB-MASK definition Acceptable and unacceptable status codes µGE¶ ± record occurrence not found µGB¶ ± End of DB reached
Status codes relate to the type of IMS call GHN. AK. AC.Segment occurrence already exists in the DB
REPL -. AJ. GB
AK ± Invalid field name in SSA
ISRT ± AB. GU ± AB. GHNP. DJ
AB ± I/O area not specified in the call AJ ± Invalid SSA format (invalid command code etc) DJ ± Segment not in µHOLD¶ status
Page : 80/128
PSB stopped U0456 -.DB being updated is full S013 -. verify that changes are correct Check the SYSOUT dump for IMS diagnostic messages Use MVS/QW to get further information on the abend
Page : 81/128
.IMS Compile option µDLITCBL¶ not set to µY¶ U0458 -.IMS Abends
U0456 -.Error opening the DB
A few tips on resolving IMS abends:
Confirm that the Abend is caused by IMS ± check the job log for IMS return code Check the JCL ± if modified from another JCL.DB Stopped U0844 -.
PIC X(20). ENVIRONMENT DIVISION. X(20). 05 FILLER 05 WARDNO-SSA 05 FILLER 01 PATIENT-SSA. 05 HOSP-NAME 05 HOSP-ADDRESS 05 HOSP-PHONE 01 WARD-I-O-AREA.
Page : 82/128
. FILE-CONTROL. PIC X(30). WORKING-STORAGE SECTION. X(4) VALUE 'GHU '. X(3). OBJECT-COMPUTER. CONFIGURATION SECTION. PIC X(19) VALUE 'WARD PIC X(04). '.Sample IMS Program
IDENTIFICATION DIVISION. PIC X(10). PIC X(20). (WARDNO ='. PIC X VALUE ')'. PIC X(4) VALUE 'GU'. FILE SECTION. 05 FILLER 05 PATNAME-SS 05 FILLER 01 UNQUAL-HOSPITAL-SSA 01 UNQUAL-WARD-SSA 01 UNQUAL-PATIENT-SSA 01 WS-ISRT 01 WS-GHU 01 HOSP-I-O-AREA. '. SOURCE-COMPUTER. INPUT-OUTPUT SECTION. PIC PIC PIC PIC PIC X(04). PIC PIC PIC PIC PIC PIC PIC PIC X(19) VALUE 'PATIENT X(20). 9(03). PATGET2. X(9) VALUE 'HOSPITAL X(9) VALUE 'WARD X(9) VALUE 'PATIENT X(4) VALUE 'ISRT'.
(PATNAME ='. 77 TOP-PAGE 77 GET-UNIQUE 01 HOSPITAL-SSA. X VALUE ')'.
'. 05 FILLER 05 HOSPNAME-SSA 05 FILLER 01 WARD-SSA. 03 WARD-NO 03 TOT-ROOMS 03 TOT-BEDS 03 BEDAVAIL 03 WARD-TYPE PIC X VALUE '1'. DATA DIVISION. PIC X VALUE ')'. PROGRAM-ID. IBM-370.
PIC X(19) VALUE 'HOSPITAL(HOSPNAME ='. XXX. IBM-370.
X(4). X(10). S9(5) COMP. X(4). INSERT-HOSP-PARA. PERFORM INSERT-HOSP-PARA THRU INSERT-HOSP-EXIT. X(8).
PIC PIC PIC PIC PIC PIC PIC PIC PIC
X(8). MOVE 'MACNEAL MOVE 'ABC DDDD' MOVE '12345' CALL 'CBLTDLI' USING PIC PIC PIC PIC PIC PIC X(20).
TO HOSP-NAME. PERFORM INSERT-WARD-01-PARA THRU INSERT-WARD-01-EXIT. X(8). XX. S9(5) COMP. 03 PATIENT-NAME 03 PATIENT-ADDRESS 03 PATIENT-PHONE 03 BEDINDENT 03 DATEADMT 03 PREV-STAY-FLAG LINKAGE SECTION.
Page : 83/128
. ENTRY 'DLITCBL' USING PCB-MASK.
WS-ISRT PCB-MASK HOSP-I-O-AREA UNQUAL-HOSPITAL-SSA. 01 PCB-MASK. TO HOSP-PHONE. X. GOBACK.)
01 PATIENT-I-O-AREA. TO HOSP-ADDRESS. S9(5) COMP. X(30). PERFORM INSERT-PATIENTS-PARA THRU INSERT-PATIENTS-EXIT. X(26).Sample Program (contd. 02 DBD-NAME-1 02 SEG-LEVEL-1 02 STATUS-CODE-1 02 PROCESS-OPTIONS-1 02 KEY-LENGTH 02 SEG-NAME-FDBK-1 02 LENGTH-FB-KEY-1 02 NUMB-SENS-SEGS-1 02 KEY-FB-AREA-1 PROCEDURE DIVISION. XX.
MOVE 'MACNEAL' MOVE 'JOHN SMITH' MOVE '123 HAMILTON STR' MOVE '12345 ' MOVE '1111' MOVE '02021999' MOVE 'N' CALL 'CBLTDLI' USING WS-ISRT PCB-MASK PATIENT-I-O-AREA HOSPITAL-SSA WARD-SSA UNQUAL-PATIENT-SSA. INSERT-PATIENTS-EXIT. DATEADMT. PREV-STAY-FLAG. TOT-ROOMS. PATIENT-ADDRESS.
TO TO TO TO TO TO TO
WARDNO-SSA. MOVE '01' MOVE 10 MOVE 20 MOVE '03' MOVE 'INTENSIVE' CALL 'CBLTDLI' USING WS-ISRT
TO TO TO TO TO
WARD-NO. BEDAVAIL WARD-TYPE.
Page : 84/128
. PCB-MASK WARD-I-O-AREA UNQUAL-HOSPITAL-SSA UNQUAL-WARD-SSA. TOT-BEDS.Sample Program (contd. IF STATUS-CODE-1 NOT EQUAL SPACES EXIT.
IF STATUS-CODE-1 NOT EQUAL SPACES EXIT. INSERT-HOSP-EXIT. EXIT. INSERT-PATIENTS-PARA. EXIT. INSERT-WARD-01-EXIT. PATIENT-NAME. EXIT. INSERT-WARD-01-PARA. PATIENT-PHONE. BEDINDENT.)
IF STATUS-CODE-1 NOT EQUAL SPACES EXIT.
Module 7 Secondary Indexing
The Need for Secondary Indexing A Customer Data Base Secondary Indexes Secondary Keys Secondary Data Structures DBDGEN Requirements for Secondary Indexes PSBGEN Requirements for Secondary Indexing Indexing a Segment based on a Dependent Segment The Independent AND Operator Sparse Sequencing Duplicate Data Fields
Page : 85/128
The Need for Secondary Indexing
Often you need to be able to access a data base in an order other than its primary hierarchical sequence Or, you may need to access a segment in a data base directly, without supplying its complete concatenated key With secondary indexing both are possible
Page : 86/128
A Customer Data Base
Fig 7.1 The customer data base
Page : 87/128
The Customer Data Base (contd.)
01 CUSTOMER-SEGMENT. 05 CS-CUSTOMER-NUMBER 05 CS-CUSTOMER-NAME 05 CS-ADDRESS-LINE-1 05 CS-ADDRESS-LINE-2 05 CS-CITY 05 CS-STATE 05 CS-ZIP-CODE * 01 SHIP-TO-SEGMENT. 05 STS-SHIP-TO-SEQUENCE 05 STS-SHIP-TO-NAME 05 STS-ADDRESS-LINE-1 05 STS-ADDRESS-LINE-2 05 STS-CITY 05 STS-STATE 05 STS-ZIP-CODE * 01 BUYER-SEGMENT. 05 BS-BUYER-NAME 05 BS-TITLE 05 BS-TELEPHONE * 01 RECEIVABLE-SEGMENT. 05 RS-INVOICE-NUMBER 05 RS-INVOICE-DATE 05 RS-PO-NUMBER 05 RS-PRODUCT-TOTAL 05 RS-CASH-DISCOUNT 05 RS-SALES-TAX 05 RS-FREIGHT 05 RS-BALANCE-DUE *
PIC PIC PIC PIC PIC PIC PIC
X(6). X(31). X(31). X(31). X(18). XX. X(9).
PIC PIC PIC PIC PIC PIC PIC
XX. X(31). X(31). X(31). X(18). XX. X(9).
PIC X(31). PIC X(31). PIC X(10).
PIC PIC PIC PIC PIC PIC PIC PIC
X(6). X(6). X(25). S9(5)V99 S9(5)V99 S9(5)V99 S9(5)V99 S9(5)V99
COMP-3. COMP-3. COMP-3. COMP-3. COMP-3.
Fig 7.2 Segment Layouts for the Customer Data Base (Part 1 of 2)
Page : 88/128
The Customer Data Base (contd.)
01 PAYMENT-SEGMENT. 05 PS-CHECK-NUMBER 05 PS-BANK-NUMBER 05 PS-PAYMENT-DATE 05 PS-PAYMENT-AMOUNT * 01 ADJUSTMENT-SEGMENT. 05 AS-REFERENCE-NUMBER 05 AS-ADJUSTMENT-DATE 05 AS-ADJUSTMENT-TYPE 05 AS-ADJUSTMENT-AMOUNT * 01 LINE-ITEM-SEGMENT. 05 LIS-ITEM-KEY. 10 LIS-ITEM-KEY-VENDOR 10 LIS-ITEM-KEY-NUMBER 05 LIS-UNIT-PRICE 05 LIS-QUANTITY *
PIC PIC PIC PIC
X(16). X(25). X(6). S9(5)V99
PIC PIC PIC PIC
X(16). X(6). X. S9(5)V99
PIC PIC PIC PIC
X(3). X(3). S9(5)V99 S9(7)
Fig 7.2 Segment Layouts for the Customer Data Base (Part 2 of 2)
Page : 89/128
Invoice No. Index Pointer Segment
Index Target Segment
Index Source Segment
Indexed Data Base
Fig 7. Seg.Secondary Indexes
Secondary Index Data Base Customer Data Base Invoice number index data base Prefix Data Rec.3 Secondary Indexing Example in which the Index Source Segment and the Index Target Segment are the same
Page : 90/128
DL/I automatically updates the index That can also result in performance degradation
Page : 91/128
DL/I maintains the alternate sequence by storing pointers to segments of the indexed data base in a separate index data base A secondary index data base has just one segment type. called the index pointer segment The index pointer segment contains two main elements± a prefix element and a data element The data element contains the key value from the segment in the indexed data base over which the index is built.Secondary Indexes (contd. even if a program that is not sensitive to a secondary index updates a data base record in a way that would affect the index. DL/I maintains it automatically as changes are made to the indexed data base± though the index is transparent to application programs that use it
So. called the index source segment The prefix part of the index pointer segment contains a pointer to the index target segment± the segment that is accessible via the secondary index The index source and target segments need not be the same After a secondary index has been set up.
If multiple access paths are required into the same data base. the number of secondary indexes for a given data base is kept low because each imposes additional processing overhead on DL/I
Page : 92/128
. the DBA can define as many different secondary indexes as necessary± each stored in a separate index data base
In practice.Secondary Indexes (contd.
The field in the index source segment over which the secondary index is built is called the secondary key The secondary key need not be the segment¶s sequence field± any field can be used as a secondary key Though usually. the DBA can combine as many as five fields in the source segment to form the complete secondary key
These fields need not even lie adjacent to each other
Secondary key values do not have to be unique
Page : 93/128
. a single field within the index source segment is designated as the secondary key for a secondary index.
even if it isn¶t actually the root segment As a result. the hierarchical sequence of the segments in the path from the index target segment to the root segment is inverted: those segments appear to be subordinate to the index target segment. even though they are actually superior to it The resulting rearrangement of the data base structure is called a secondary data structure Receivable
Page : 94/128
Fig 7.Secondary Data Structures
A secondary index changes the apparent hierarchical structure of the data base The index target segment is presented to your program as if it were a root segment.4 Secondary Data Structure for the Secondary Index
Secondary data structures don¶t change the way the data base segments are stored on disk
They just alter the way DL/I presents those segments to application programs
When you code an application program that processes a data base via a secondary index. you must consider how the secondary data structure affects your program¶s logic
Page : 95/128
.Secondary Data Structures (contd.
two DBDGENs are required± one for the indexed data base and the other for the secondary index data base
Fig 7.DBDGEN Requirements for Secondary Indexes
Because a secondary index relationship involves two data bases.5 Partial DBDGEN output for the customer data base showing the code to implement the secondary index
Page : 96/128
6 DBDGEN output for the Secondary Index Data Base
In the DBDGEN for the indexed data base.DBDGEN Requirements for Secondary Indexes (contd. an LCHILD macro relates an index target segment to its associated secondary index data base In the DBDGEN for the secondary index data base.)
Fig 7. an LCHILD macro relates the index pointer segment to the index target segment
Page : 97/128
5 supplies a field name (CRRECXNO) that is used to access the data base via the secondary key
This key field does not become a part of the segment Instead.6 specifies the name of the secondary key field± CRRECXNO The XDFLD macro in Fig 7.6 tells DL/I that an index data base is being defined The INDEX parameter of the LCHILD macro in Fig 7. its value is derived from up to five fields defined within the segment with FIELD macros
The SRCH parameter defines the field(s) that constitute the secondary index
Page : 98/128
.DBDGEN Requirements for Secondary Indexes (contd.)
ACCESS=INDEX in the DBD macro in Fig 7.
7 PSBGEN Output
Page : 99/128
.PSBGEN Requirements for Secondary Indexing
Just because a secondary index exists for a data base doesn¶t mean DL/I will automatically use it when one of your programs issues calls for that data base You need to be sure that the PSBGEN for the program specifies the proper processing sequence for the data base on the PROCSEQ parameter of the PSB macro If it doesn¶t. the DBA codes the DBD name for the secondary index data base that will be used
Fig 7. processing is done using the normal hierarchical sequence for the data base For the PROCSEQ parameter.
the program¶s PSBGEN will contain more than one PCB macro. processing is done based on the secondary index sequence If a program needs to access the same indexed data base using different processing sequences.PSBGEN Requirements for Secondary Indexing (contd.7 reflect the secondary data structure imposed by the secondary index When the PROCSEQ parameter is present.)
The SENSEG macros in Fig 7. each specifying a different value for the PROCSEQ parameter
Page : 100/128
8 Secondary Indexing Example in which the Index Source Segment and the Index Target Segment are different
Page : 101/128
. Index Pointer Segment
Index Source Segment
Indexed Data Base
Fig 7. Addr.Indexing a Segment based on a Dependent Segment
Secondary Index Data Base Customer Data Base Index Target Segment Invoice number index data base Prefix Cust. Data Item No. Seg.
you can retrieve customers based on items they have purchased In other words. the Index Target Segment and the Index Source Segment are different For example. it wouldn¶t be possible to index the buyer segment based on values in the line item segment. the SSA for a get call would specify an item number.8. in Fig 7.8.)
The Index Source Segment and the Index Target Segment need not be the same Some applications require that a particular segment be indexed by a value that is derived from a dependent segment
In such a case.Indexing a Segment based on a Dependent Segment (contd. but the call would retrieve a customer segment
The only restriction you need to be aware of here is that the Index Source Segment must be a dependent of the Index Target Segment
Thus. in the example shown in Fig 7. you couldn¶t index the line item segment based on the customer segment. because the customer segment is superior to the line item segment
Page : 102/128
. because the line item segment isn¶t dependent on the buyer segment Similarly .
PIC X(10) VALUE µCRLINXNO =¶. PIC X VALUE µ)¶. PIC X(8). PIC X(10) VALUE µCRLINXNO =¶.The Independent AND Operator
When used with secondary indexes. PIC X(8). PIC X VALUE µ#¶. a dependent AND requires that all fields you specify in the SSA be in the same segment occurrence An SSA that uses the independent AND operator is shown below
01 ITEM-SELECTION-SSA. you can code an SSA with the independent AND to specify that an occurrence of the target segment be processed based on fields in two or more dependent source segments In contrast. * 05 FILLER 05 FILLER 05 SSA-ITEM-KEY-1 05 FILLER 05 FILLER 05 SSA-ITEM-KEY-2 05 FILLER
PIC X(9) VALUE µCRCUSSEG(¶.
Page : 103/128
. AND ( * or & ) is called the dependent AND operator The independent AND (#) lets you specify qualifications that would be impossible with the dependent AND This operator can be used only for secondary indexes where the index source segment is a dependent of the index target segment Then.
When the DBA implements a secondary index data base with sparse sequencing (also called sparse indexing). a suppression routine. no index relationship is established (for an insert) or expected (for any other call) The DBA can also specify a suppression routine that DL/I invokes to determine the index status for the segment The suppression routine is a user-written program that evaluates the segment and determines whether or not it should be indexed Note:
When sparse indexing is used. or both to determine whether a segment should be indexed (either when inserting a new segment or processing an existing one) If the value of the sequence field(s) in the index source segment matches a suppression value specified by the DBA. its functions are handled by DL/I You don¶t need to make special provisions for it in your application program
Page : 104/128
. it is possible to omit some index source segments from the index Sparse sequencing can improve performance when some occurrences of the index source segment must be indexed but others need not be DL/I uses a suppression value.
Duplicate Data Fields
For some applications, it might be desirable to store user data from the index source segment in the index pointer segment When the DBA specifies that some fields are duplicate data fields, this is possible Up to five data fields can be stored in the index data base, and DL/I maintains them automatically Duplicate data fields are useful only when the index data base is processed as a separate data base Note:
Duplicate data fields impose extra DL/I overhead and require extra DASD storage It is the DBA¶s responsibility to decide whether the advantages of using duplicate data fields outweigh the extra DL/I overhead and DASD storage requirements mentioned above
Page : 105/128
Module 8 Logical Data Bases
Introduction to Logical Data Bases Logical Data Base Terminology DBDGENs for Logical Data Bases
Page : 106/128
An Introduction to Logical Data Bases
Inter related databases. databases A logical child segment has 2 parent segments One physical parent and one logical parent
DB1 Physical Parent
Real Logical Child
Virtual Logical Child
Page : 107/128
Accesses in both the directions.
The child accesses logical parent¶s data but the reverse is not allowed.
Accesses in both the directions. but the child exists both in the physical DB as well as the logical DB.
Page : 108/128
.Logical Data Base Terminology
Real Logical Child
The child under consideration
Original parent of the child
The parent in the other data base
Virtual Logical Child
The child as seen from the other data base
Three types of Logical data bases
Unidirectional. but the child exists only in the physical DB.
DBDGENs for a Logical Data Base
******DBD1****** . RULES=(LLV. 7 PARENT=(PP. 6 SEGM NAME=RLC. . (LP. 8 POINTER=(TWIN.PTR). . . BYTES=48 7 LCHILD NAME= (RLC.LAST).BYTES=16 9 FIELD NAME=******************************** 10 FIELD NAME=******************************** .DBD1).LTWIN). PARENT=SEG-1.
******DBD2******* . . PAIR=VLC 8 FIELD NAME=******************************** 9 FIELD NAME=******************************** 10 FIELD NAME=********************************
Page : 109/128
. POINTER=PTR. . 6 SEGM NAME=LP.DBD2). .
Module 9 Recovery and Restart
Introduction to Data Base Recovery Introduction to Checkpointing Types of Checkpointing Extended Restart Database Image Copy
Page : 110/128
correct the error and rerun the program. Types of recoveries
Forward recovery Backward recovery
Data base changes for a time period is accumulated A copy of the data base is created The changes are applied to this data base copy DL/I uses change-data stored in DL/I logs for forward recovery Used when a data base is physically damaged
Data base changes due to the failed program is reverted directly in the data base Program log records are read backwards and their effects are reversed in the data base When back out is complete data base is in the former state that was before the failure Normally applied when the program ends in a controlled fashion and no data base damage
Page : 111/128
.Introduction to Data Base Recovery
The process of recovering the data base in case of application program failure Back out changes made by the abended program.
explicit checkpoints can be specified Explicit checkpoints can be established using checkpoint call(CHKP) inside the program CHKP creates a checkpoint record on DL/I log which prevents recovery before that point
Page : 112/128
. sync point. commit point and point of integrity Program execution point at which the DB changes are complete and accurate DB changes made before the most recent checkpoint are not reversed by recovery Normally the start of the pgm is considered as a default checkpoint In case of a number of DB updates.Introduction to Checkpointing
Synonyms: synchronization point.
in case of a failure Store program data and CHKP records and retrieve them at the time of restart Along with symbolic CHKP call you must use the XRST (Extended Restart) call too.Types of Checkpointing
Types of checkpointing
Basic checkpointing Symbolic checkpointing
Simple form of checkpointing.
Page : 113/128
. Issues checkpoint calls that the DL/I recovery utilities use during recovery processing
More advanced type of checkpointing Used in combination with extended restart Programs resume from the point following the checkpoint.
Extended Restart (XRST)
The XRST call is used in connection with the symbolic checkpoint call It is used to restart your program The XRST call precedes a symbolic checkpoint call The XRST call must be issued only once It should be issued early in the execution of the program It must precede any CHKP call The program is restarted from a symbolic CHKP taken during a previous execution of the program The CHKP used to perform the restart can be identified by entering the checkpoint ID CHKP ID can be specified in 2 ways
In the I/O area pointed to by the XRST call Specifying ID in the CKPTID= field of EXEC statement in the program's JCL
Page : 114/128
revert to the DB generated by image copy job and rerun Commonly used image copy utility is BMC Software¶s ICPUMAIN Database and Image copy DD names specified in the ICPSYSIN card Advantage : Simple.Database Image Copy
Job which is run to take backup copies of IMS database datasets at periodic intervals
Traditionally. Fast. batch cycle starts at 7 pm and ends at 7 am Image Copy jobs are usually run before and after a batch cycle If abend occurs. Automated procedure
Page : 115/128
Module 10 DL/I Data Base Organizations
DL/I Organizations & Access Methods Hierarchical Sequential Organization Hierarchical Direct Organization Additional IMS Access Methods
Page : 116/128
Hierarchic Direct : In this the segment occurrences include prefixes that contain direct pointers to related segments.DL/I Organizations & Access Methods
File Organization is a description of how a file is processed & Access Method is the software used to implement that processing.
Page : 117/128
. DL/I provides two basic data base organizations :
Hierarchic Sequential: In this the segments that make up the database record are related to one another by their physical locations.
An index is also maintained to allow random access to any database record.The application programs cannot replace or delete segments without copying the entire database. SHISAM(Simple Hierarchic Indexed Sequential Access Method ) : Similar to HISAM and used in cases in which the database consist of only root segments.
Page : 118/128
. SHSAM & SHISAM are used primarily for converting standard files to DL/I data bases. SHSAM( Simple Hierarchical Sequential Access Method):Similar to HSAM but used to support databases that consist only of root segments.Hierarchic Sequential Organizations Access Methods
HS Organizations provide four types of Access Methods
HSAM ( Hierarchic Sequential Access Method) : The program in HSAM database works through it sequentially from beginning to end. HISAM (Hierarchic Indexed Sequential Access Method): In HISAM the data is stored with hierarchic sequential organization.
HDAM databases are not appropriate for sequential processing.Hierarchic Direct Organization Access Method
HDAM ( Hierarchic Direct Access Method ):
HDAM stores root segment occurrences based on a randomizing routine. Root segments can be retrieved in sequence.
HIDAM (Hierarchic Indexed Direct Access Method) :
Segment data in HIDAM is stored in the same way like that in HDAM. Occurrences of dependent segments are related to root and one another by a system of pointers the HD Organization is based upon. In HIDAM. unlike HDAM root segment is located through an index.
Page : 119/128
It provides fast access to data and it contains only a small amount of data. Processing of database is sequential . IMS recovery facilities can be used. These are root-segment-only data bases. ISRT add data only at the end of database & REPL and DLET calls are not supported. Two types of Fast Path databases : MSDB(Main Storage Data Base ) & DEDB( Data Entry Data Base ).
Fast Path data bases:
Fast Path data bases provide fast processing of simple data structures. Data is processed on a record to record to basis but through DL/I calls.
Page : 120/128
.Additional IMS Access Methods
GSAM( Generalized Sequential Access Methods):
GSAM lets application files to be treat OS sequential files as databases. They are typically used during conversion from a system that uses standard files to one that uses data bases. Since files are considered by IMS to be databases.
MSDB(Main Storage Data Base) :
It is used to store an application¶s most intensively used data and resides in virtual storage.
DEBD¶s use a complicated storage scheme that involves separating the data base into as many as 240 areas and this allows very large data bases.Additional IMS Access Methods (contd. as direct dependent segment types.
Page : 121/128
DEDB( Data Entry Data Base ) :
DEBD is stored in disk and has a hierarchical structure They are organized in typical DL/I fashion..
Module 11 Advanced DL/I features
Variable Length Segments DBD for GSAMs PCB for GSAMs
Page : 122/128
POINTER=TR. then a lot of space is wasted in cases where it contains shorter strings. then we define those fields as variable length fields The segment with such a field defined in it is called Variable Length Segment For description and explanatory fields.PARENT=0.Variable Length Segments
When a field length that is stored in a segment type varies. if we define them long enough to accommodate the longest possible text. The SEGM macro in DBD is defined as
SEGM NAME=INVENSEG. Length PIC S 9(4) The I-O area should be large enough to accommodate the Maximum variable length segment + Length field Before an ISRT / REPLACE / DELETE call is issued we have to move the actual length to the length field in the I/O area
Page : 123/128
.n m=maximum length of the segment + 2 bytes n=minimum length of the segment + 2 bytes
The extra two bytes is used to store the length field of the occurrence of the variable length segment In Application Program :
The length field has to be included in the I-O Area for the segment.BYTES=m. for example Description or Explanatory text.
Variable Length Segments are appropriate when segment occurrence length vary but once created and made stabilized. Disadvantage:
If the occurrence of the segment type grows in length then Variable length segment will drop performance When segment type occurrences grow in size then it split's into 2 parts which are not stored in the same physical record. so we require two I/O operations to fetch the segment therefore the performance drops
Page : 124/128
.Variable Length Segments (contd.
RECORD=80 DBDGEN FINISH END
In GSAM DBD's you can't specify
SEGM and FIELD statements The use of logical or index relationships between segments
IMS adds 2 bytes to the record length value specified in the DBD in order to accommodate the ZZ field.DBD for GSAMs
During DBD generation for a GSAM database we should specify one dataset group The DD name of the input dataset that is used when the application retrieves data from the database The DD name of the output dataset used when loading the database.ACCESS=(GSAM. The DBD for a GSAM is shown below
DBD NAME=CARDS.BSAM) DATASET D1=ICARDS.RECFM=F.DD2=OCARDS.
Page : 125/128
no delete operation can be performed on GSAM Database. IMS adds 2 bytes. The record size of the GSAM database is 2 bytes greater than the longest segment that is passed to IMS by the application program. A database if defined as GSAM has the advantage of the usage of CHECKPOINT and RESTART Disadvantage of GSAM database : Only inserts can be done to the DB which is defined as GSAM.
Page : 126/128
.DBD for GSAMs (contd.)
Whenever the database is GSAM/BSAM and the records are variable (V or VB).
The GSAM PCB statement must follow the PCB statements with TYPE=TP or DB if any exist in the PSB generation.PCB for GSAMs
The PCB for a GSAM database is coded as shown below
PCB TYPE=GSAM.PROCOPT=A PCB TYPE=GSAM.KEYLEN=100 SENSEG NAME=PARTMAST. the rule is:
TP PCBs First DB PCBs Second GSAM PCBs Last
A sample PSB is shown below
PCB TYPE=TP.DBDNAME=PARTMSTR.PARENT=0.PROCOPT=LS PSBGEN LANG=COBOL.NAME=OUTPUT1 PCB TYPE=DB.PROCOPT=A.PROCOPT=A SENSEG NAME=CPWS.PSBNAME=APPLPGM3 END
Page : 127/128
Page : 128/128