Ims DB
Ims DB
Page : 1/128
Objectives
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
Prerequisites
Knowledge of COBOL Basic knowledge of data base management concepts
Page : 3/128
Course Outline
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 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
References
IMS for the COBOL Programmer
Part 1: Data base processing with IMS/VS and DL/I DOS/VS By Steve Eckols
Page : 5/128
Hierarchical Structures Why a Data Base Management System Basic DL/I Terminology Basic DL/I Data Base Processing
Page : 6/128
Hierarchical Structures
In a DL/I data base, data elements are organized in a hierarchical structure. Some data elements are dependent on others.
DL/I supports hierarchies that are difficult to implement with standard files.
Page : 7/128
01
INVENTORY-RECORD. 05 IR-ITEM-KEY. 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). PIC X(5). PIC X(35). PIC S9(5)V99 COMP-3. PIC S9(5)V99 COMP-3. 20 TIMES. PIC X(3). PIC S9(7) COMP-3. PIC S9(7) COMP-3. PIC S9(7) COMP-3. PIC X(6).
Fig 1.2.b Record layout for the Inventory Master data set Fig 1.2 Record layouts that illustrate a hierarchical structure
Page : 8/128
Segment Type
A category of data There can be a maximum of 255 segment types and 15 levels in one data base
Segment Occurrence
One specific segment of a particular type containing user data
Note:Within a data base there is only one of each segment type- its part of the data bases definition- but there can be an unlimited number of occurrences of each segment type. 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
Item
Stock Location Fig 1.4 The hierarchical structure of * 01 INVENTORY-VENDOR-SEGMENT. 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. 05 IIS-NUMBER 05 IIS-DESCRIPTION 05 IIS-UNIT-PRICE 05 IIS-AVG-UNIT-COST * 01 INVENTORY-STOCK-LOC-SEGMENT. 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). X(30). X (17). XX. X(9). X(10).
Page : 10/128
Item 2 Item 1
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
Parent Segment
A segment that has one or more dependent segments
Child Segment
Every dependent segment in a hierarchy
Twin Segment
Two or more segment occurrences of the same type and with the same segment occurrence as their parent
Path
Series of segments leading from the root segment occurrence down to any specific segment occurrence Must be continuous- intermediate levels cant be skipped
Page : 12/128
Concatenated field
Key formed to access a particular segment Concatenation of keys of root segment and all successive children down to the accessed segment
Undefined fields
Fields not defined to IMS Format determined by the program loading the DB
Page : 13/128
Customer
Ship-to
Vendor
Buyer
Receivable
Item
Payment
Adjustment
Line Item
Stock Location
In Fig 1.7, the line item segment is the logical child segment (or just logical child) of the item segment. Likewise, the item segment is the logical parent segment (or just logical parent) of the line item segment
Page : 14/128
Vendor 1
Vendor 2
Item 2 Item 1
Loc 2 Data base Record 1 Loc 5 Loc 4 Loc 3 Loc 2 Loc 1 Fig 1.8 Sequential processing Loc 1
Loc 2 Loc 1
Page : 15/128
Vendor 1
Vendor 2
Item 2 Item 1
Loc 2 Data base Record 1 Loc 5 Loc 4 Loc 3 Loc 2 Loc 1 Loc 1
Page : 16/128
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
IMS DC
Remote Terminal
DL/I
OS
Data Base
Page : 18/128
Application Program
Application Program
DL/I
Fig 2.2 Standard file processing compared to DL/I data base processing
Page : 19/128
Page : 20/128
Control Blocks
Physical structure of a DL/I data base isnt specified in an application program DL/I uses a set of control blocks(DBDs and PSBs) to define a data bases structure Data Base Descriptor (DBD)
Describes the complete structure of a data base A unique DBD for each DL/I data base
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
Fig 2.3 Assembler source listing for the Inventory data base DBDGEN
Page : 22/128
POINTER parameter and LCHILD macro are needed for HIDAM Databases Only search fields need be specified in the DB
Page : 23/128
DBDGEN (contd.)
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
Data Type Character Packed decimal Zoned decimal Hexadecimal Half word Binary Full word Binary
Page : 24/128
SAMPLE PSBGEN
STMT SOURCE STATEMENT 1 PRINT NOGEN 2 PCB TYPE=DB,DBDNAME=INDBD,PROCOPT=LS 3 SENSEG NAME=INVENSEG 4 SENSEG NAME=INITMSEG,PARENT=INVENSEG 5 SENSEG NAME=INLOCSEG,PARENT=INITMSEG 6 PSBGEN PSBNAME=INLOAD,LANG=COBOL 87 END Fig 2.5 Assembler source listing for the Inventory data base load programs PSBGEN
Page : 25/128
PSBGEN (contd.)
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 programs processing options For each PCB macro, 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.
Page : 26/128
The PROCOPT given for a Sensitive segment would override the one given for the DB
Example : PCB TYPE=DB,NAME=LDB42F,PROCOPT=G, KEYLEN=200 SENSEG NAME=SEGL4201, PARENT=0,PROCOPT=A WARNING : Indiscriminate use of PROCOPTS can lead to inexplicable results !
Page : 27/128
Page : 28/128
Page : 29/128
Page : 30/128
The ENTRY and GO BACK Statements The DL/I Call The PCB Mask
Page : 31/128
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 programs 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 programs 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
CBLTDLI => COBOL to DL/I, is an interface module that is link edited with your programs object module PLITDLI, ASMTDLI are other options
Page : 33/128
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
GU . GHU . GN . GHN . GNP . GHNP. ISRT. DLET. REPL. CHKP. XRST. PCB .
Page : 34/128
Update functions
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
Page : 36/128
Page : 37/128
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
Page : 39/128
Segment level
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
Status code
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 isnt normal, 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
Page : 40/128
Page : 41/128
Types of SSAs Basic Unqualified SSA Basic Qualified SSA Command Codes The Null Command Code Path Call Multiple Qualifications
Page : 42/128
Types of SSAs
SSA identifies the segment occurrence you want to access It can be either
Qualified Unqualified
An unqualified SSA simply names the type of segment you want to use A qualified SSA specifies not only the segment type, 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, 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
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, 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
Alternatively, you can code the segment name as a literal when you define a qualified SSA
For example,
01 UNQUAL-VENDOR-SSA PIC X(9) VALUE INVENSEG . * 01 UNQUAL-ITEM-SSA PIC X(9) VALUE INITMSEG . * 01 UNQUAL-STOCK-LOC-SSA PIC X(9) VALUE INVENSEG .
Page : 45/128
01 *
VENDOR-SSA. 05 05 05 05 FILLER FILLER VENDOR-SSA-CODE FILLER PIC PIC PIC PIC X(9) VALUE INVENSEG(. X(10) VALUE INVENCOD =. X(3). X VALUE ).
*
Fig 4.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
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 doesnt have a fixed length The last character in the qualified SSA is a right parenthesis
Page : 47/128
Command Codes
Page : 49/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
Page : 50/128
Page : 51/128
Path Call
A DB call with an SSA that includes the 'D' Command code is a "PATH CALL . Its 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
Normally, DL/I operates on the lowest level segment that is specified in an SSA(STOCK-LOC-SSA in the above E.g.) 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.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. If path call is not explicitly enabled in the PSBGEN job there will be an 'AM' status code.
Page : 52/128
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, you connect two or more qualification statements (a field name, a relational operator, and a comparison value) within the parentheses of the SSA. To connect them, 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
The above SSA, 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; 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; 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
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
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.
A typical GU call like the one above, 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
Page : 57/128
Page : 58/128
The GN Call
CALL CBLTDLI USING DLI-GN INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT STOCK-LOCATION-SSA.
Used for basic sequential processing After any successful data base call, your data base position is immediately before the next segment occurrence in the normal hierarchical sequence Before your program issues any calls, 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, if it does not employ an SSA), it returns the next segment occurrence in the data base regardless of type, 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, DL/I allows any occurrence of that segment type to satisfy the call But when you specify a qualified SSA, DL/I selects only those segment occurrences that meet the criteria you specify
Page : 59/128
Used for sequential processing within parentage Works like the GN call, except it retrieves only segments that are subordinate to the currently established parent To establish parentage, your program MUST issue either a GU call or a GN call, and the call must be successful
Parentage is never automatically established, 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
Item 2
Loc 2 Loc 1 Fig 5.1 Sequential retrieval with GNP call Loc 5 Loc 4 Loc 3 Loc 2 Loc 1
Page : 61/128
Page : 62/128
Page : 63/128
Page : 64/128
Page : 65/128
Page : 66/128
Page : 67/128
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. Through multiple PCBs 2. Through multiple positioning
Multiple PCBs
The DBA can define multiple PCBs for a single data base Then, the program has two (or more) views of the data base As with PCBs for different data bases, each has its own mask in the Linkage Section and is specified in the ENTRY statement It is up to the programs logic to decide when to use a particular PCB to access the data base This method for implementing multiple processing, though flexible, is inefficient because of the overhead imposed by the extra PCBs
Page : 68/128
C13 C12 B13 B12 B11 Data base Record 2 C22 B22 C11 A2
C21
B21
Page : 69/128
When you use multiple positioning, 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 programs PSB As a result multiple positioning is not the characteristic of the data base but instead, its 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 programs PSB
Page : 70/128
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
Here UNQUALIFIED-SSA specifies the segment name Because the SSA is unqualified, 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
If SSAs for vendor and item are initialized with the proper key values, 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, DL/I returns a status code of GE if any segment occurrence you specify in an SSA isnt present in the data base As a result, 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), you can save system resources
Page : 73/128
For a segment with non-unique sequence fields, the rules are similar, but they determine where the new segment is positioned relative to existing twin segments that have the same key value
Page : 74/128
Page : 75/128
These calls parallel the three retrieval calls earlier discussed Before you can replace or delete a segment, you must declare your intent to do so, 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
Never code a qualified SSA on an REPL call: if you do, 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. ADD TRANS-RECEIPT-QTY TO ISLS-QUANTITY-ON-HAND. SUBTRACT TRANS-RECEIPT-QTY FROM ISLS-QUANTITY-ON-ORDER. CALL CBLTDLI USING DLI-REPL INVENTORY-PCB-MASK INVENTORY-STOCK-LOC-SEGMENT. CALL CBLTDLI USING
Page : 77/128
Page : 78/128
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, 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
Status codes relate to the type of IMS call GHN, GHNP, GHU, GU AB, AK, GE, GB
AK Invalid field name in SSA
Page : 80/128
IMS Abends
U0456 -- PSB stopped U0456 -- IMS Compile option DLITCBL not set to Y U0458 -- DB Stopped U0844 -- DB being updated is full S013 -- Error opening the DB
Page : 81/128
PIC X(19) VALUE 'HOSPITAL(HOSPNAME ='. PIC X(20). PIC X VALUE ')'. PIC X(19) VALUE 'WARD PIC X(04). PIC X VALUE ')'. PIC PIC PIC PIC PIC PIC PIC PIC X(19) VALUE 'PATIENT X(20). X VALUE ')'. X(9) VALUE 'HOSPITAL X(9) VALUE 'WARD X(9) VALUE 'PATIENT X(4) VALUE 'ISRT'. X(4) VALUE 'GHU '. (WARDNO ='.
(PATNAME ='.
PIC X(20). PIC X(30). PIC X(10). PIC PIC PIC PIC PIC X(04). 9(03). XXX. X(3). X(20).
Page : 82/128
X(8). XX. XX. X(4). S9(5) COMP. X(8). S9(5) COMP. S9(5) COMP. X(26).
Page : 83/128
TO TO TO TO TO
IF STATUS-CODE-1 NOT EQUAL SPACES EXIT. INSERT-WARD-01-EXIT. EXIT. INSERT-PATIENTS-PARA. 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. IF STATUS-CODE-1 NOT EQUAL SPACES EXIT. INSERT-PATIENTS-EXIT. EXIT.
TO TO TO TO TO TO TO
Page : 84/128
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
Page : 86/128
Customer
Ship-to
Buyer
Receivable
Payment
Fig 7.1 The customer data base
Adjustment
Line Item
Page : 87/128
Fig 7.2 Segment Layouts for the Customer Data Base (Part 1 of 2)
Page : 88/128
COMP-3.
COMP-3.
COMP-3. COMP-3.
Fig 7.2 Segment Layouts for the Customer Data Base (Part 2 of 2)
Page : 89/128
Secondary Indexes
Secondary Index Data Base Customer Data Base Invoice number index data base Prefix Data Rec. Seg. Addr. Invoice No. Index Pointer Segment
Customer
Ship-to
Buyer
Receivable
Payment
Adjustment
Line Item
Indexed Data Base
Fig 7.3 Secondary Indexing Example in which the Index Source Segment and the Index Target Segment are the same
Page : 90/128
Page : 92/128
Secondary Keys
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 segments sequence field any field can be used as a secondary key Though usually, a single field within the index source segment is designated as the secondary key for a secondary index, 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
Page : 93/128
Ship-to
Payment
Adjustment
Line Item
Customer
Buyer
Page : 94/128
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 programs logic
Page : 95/128
Fig 7.5 Partial DBDGEN output for the customer data base showing the code to implement the secondary index
Page : 96/128
Fig 7.6 DBDGEN output for the Secondary Index Data Base
In the DBDGEN for the indexed data base, an LCHILD macro relates an index target segment to its associated secondary index data base In the DBDGEN for the secondary index data base, an LCHILD macro relates the index pointer segment to the index target segment
Page : 97/128
The SRCH parameter defines the field(s) that constitute the secondary index
Page : 98/128
Page : 99/128
Page : 100/128
Customer
Ship-to
Buyer
Receivable
Payment
Adjustment
Line Item
Indexed Data Base
Fig 7.8 Secondary Indexing Example in which the Index Source Segment and the Index Target Segment are different
Page : 101/128
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.8, it wouldnt be possible to index the buyer segment based on values in the line item segment, because the line item segment isnt dependent on the buyer segment Similarly , you couldnt index the line item segment based on the customer segment, because the customer segment is superior to the line item segment
Page : 102/128
PIC X(9) VALUE CRCUSSEG(. PIC X(10) VALUE CRLINXNO =. PIC X(8). PIC X VALUE #. PIC X(10) VALUE CRLINXNO =. PIC X(8). PIC X VALUE ).
Page : 103/128
Sparse Sequencing
When the DBA implements a secondary index data base with sparse sequencing (also called sparse indexing), 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, a suppression routine, 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, 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, its functions are handled by DL/I You dont need to make special provisions for it in your application program
Page : 104/128
Page : 105/128
Introduction to Logical Data Bases Logical Data Base Terminology DBDGENs for Logical Data Bases
Page : 106/128
SEG-1
DB1 Physical Parent
PP
LP
Logical Parent
SEG-a
SEG-b
RLC
Real Logical Child
C2
VLC
Virtual Logical Child
Page : 107/128
Physical Parent
Original parent of the child
Logical Parent
The parent in the other data base
Bi-directional virtual.
Accesses in both the directions, but the child exists only in the physical DB.
Bi-directional physical.
Accesses in both the directions, but the child exists both in the physical DB as well as the logical DB.
Page : 108/128
******DBD2******* . . . 6 SEGM NAME=LP, PARENT=SEG-1, BYTES=48 7 LCHILD NAME= (RLC,DBD1), POINTER=PTR, PAIR=VLC 8 FIELD NAME=******************************** 9 FIELD NAME=******************************** 10 FIELD NAME=********************************
Page : 109/128
Introduction to Data Base Recovery Introduction to Checkpointing Types of Checkpointing Extended Restart Database Image Copy
Page : 110/128
Forward 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
Backward Recovery
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 Checkpointing
Synonyms: synchronization point, 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, 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
Types of Checkpointing
Types of checkpointing
Basic checkpointing Symbolic checkpointing
Basic checkpointing
Simple form of checkpointing. Issues checkpoint calls that the DL/I recovery utilities use during recovery processing
Symbolic checkpointing
More advanced type of checkpointing Used in combination with extended restart Programs resume from the point following the checkpoint, 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.
Page : 113/128
Page : 114/128
Page : 115/128
DL/I Organizations & Access Methods Hierarchical Sequential Organization Hierarchical Direct Organization Additional IMS Access Methods
Page : 116/128
Page : 117/128
Page : 118/128
Page : 119/128
Page : 120/128
Page : 121/128
Page : 122/128
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. 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
Page : 124/128
IMS adds 2 bytes to the record length value specified in the DBD in order to accommodate the ZZ field.
Page : 125/128
Page : 126/128
The GSAM PCB statement must follow the PCB statements with TYPE=TP or DB if any exist in the PSB generation, the rule is:
TP PCBs First DB PCBs Second GSAM PCBs Last
Page : 127/128
Thank You
Page : 128/128