ims-db-dc

107
IMS Class Room Session IMS IMS/DB Program is the user of IMS/DB. Types of processing Online Transaction Processing Message Processing Program (MPP) Two Batch Environment Shared Batch Processing (BMP) Exclusive Batch (DL/I)(DBB) Level of Abstraction Cobol VSAM MVS DASD READ Macro Low Level Routines GET, PUT CCHH IMS Database If EMP personal data is deleted, all the others should get deleted. This is referential integrity. Developed By: Shilpa Keluskar & Suvarnalata NaikPage 1 of 107 EMP PERSONAL DATA EMP PAYROLL EMP LIBRARY EMP SKILL

Upload: pvnkraju

Post on 25-Aug-2014

127 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: IMS-DB-DC

IMS Class Room Session

IMSIMS/DB

Program is the user of IMS/DB.

Types of processing

Online Transaction ProcessingMessage Processing Program (MPP)

Two Batch EnvironmentShared Batch Processing (BMP)Exclusive Batch (DL/I)(DBB)

Level of Abstraction

Cobol VSAM MVS DASD

READ Macro Low Level Routines

GET, PUT CCHH

IMS Database

If EMP personal data is deleted, all the others should get deleted. This is referential integrity.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 1 of 85

EMP PERSONAL DATA

EMP PAYROLL

EMP LIBRARY

EMP SKILL

Page 2: IMS-DB-DC

IMS Class Room Session

IMS data manager

VIEW LOGICAL MODEL PHYSICAL LAYER

What user wants DASD

Hierarchical Model

User deals with logical view only. He is not bothered about how data is stored physically. This is data independence.

IMS Logical Structure

ParentLevel 1

Parent/Child Level 2

Child Level 3

Twins

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 2 of 85

CUSTOMER

ORDER

DELIVERY

ITEM

Page 3: IMS-DB-DC

IMS Class Room Session

Process and Level Of Abstraction

IMS/DM

HISAM VSAM MVSHDAM OSAM HIDAM

Disk VolumesNote: PSB and DBD must be created before executing program.

View determines what user can see and PSB determines View How to use IMS Database Manager?

1. Create Hierarchical Model2. Inform IMS/DM about your data model.

This model is to be translated to physical medium. The process is called Database Description Generation.DBDGEN:- Creates DBD elements for IMS. Now IMS knows about your data model.Now model is created, need to put segments into it. Therefore need to provide access to user.

3. Provide access to user-Which database/segments/fields-What user can do – CRUDHow this view is defined?This is done by Program Specification Block Generation.PSBGEN:- Creates PSB elementsPSB restricts/allows what user can see. Here user is a program.

DBA looks after these things i.e. 1,2,3Programmer never defines new databases.For any new program, you need to create PSB element.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 3 of 85

PSB DBD

ACBPCB

Hierarchical Access Methods

DL/I File Management

Low Level I/O routines

PROGRAM

Page 4: IMS-DB-DC

IMS Class Room Session

Process Access Request

What – CRUD (Create, Replace, Update, Delete) On what – dbd(one PCB for each database)/segment/segment qualification With what/where – segment i-o Area (Here IMS returns the required data in this

area defined in working storage) Was it successful – Communication PCB (equivalent to SQLCA)

IMS reports on the call through program communication block.IMS provides this programming interface through DL/I calls.

CALL ‘CBLTDLI’ USING FUNCTION PCB DBD feedback I-O-AREA

SSA Segment Qualification

Individual hierarchical model is one database. Collection of all databases is corporate database. (Only for IMS)

Assignment1 :-

Utility CAISACB is equivalent of DBDGEN.Create a file DBD1.ACB using text editor (EDIT), invoke the utility CAISACB to create a database. In the same file write DBD and then PSB specification.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 4 of 85

Page 5: IMS-DB-DC

IMS Class Room Session

Day 3

Persistent Data

Problems:-

1. Durability2. Concurrent Usage (Isolation)3. Manage (catalog)

Catalog policy:- Recovery ,Easy Access

Assignment2:

Two Entities: EMPLOYEE & PROJECT

Hierarchical Model

Here there are two databases.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 5 of 85

IMSSRCLIB: DBD source

DBDLIB: Generated DBD---------------Get the information

IMS/ESA Version 6.0 Manual, Utilities Reference-System (Generated Utilities)

Library Reader for Windows (download from Internet or Cds)

EMP

PR SKL

PROJECT

ASSIGN

Page 6: IMS-DB-DC

IMS Class Room Session

EMP

EMPNO PIC X(06) UniqueEMPNAME PIC X(30)EMPADR PIC X(40)

PR

PRYYYYMM PIC X(06) UniqueNET-PAY-AMT PIC 9(06)

SKL

SKL-ID PIC X(03) UniqueSKL-NAME PIC X(30)EXPYRS PIC 9(02)

PROJECT

PROJECT-ID PIC X(04) UniqueNAME PIC X(20)CLIENT-NAME PIC X(50)

ASSIGN

EMPNO PIC X(06) UniqueSTART-DATE PIC X(08)END-DATE PIC X(08)

Three ways of accessing information:-

1. Random2. Sequential (all)3. Sequential with criteria

EMPNO is a Key field. Therefore all the EMP occurrences will be in ascending order of EMPNOOne root with all dependents is a database record

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 6 of 85

Page 7: IMS-DB-DC

IMS Class Room Session

PRINT NOGENDBD NAME=EMPDB

SEG NAME=EMP,PARENT=0,BYTES=76FIELDFIELDFIELDSEG NAME=PR,PARENT=EMP,BYTES=12FIELDFIELDSEG NAME=SKL,PARENT=EMP,BYTES=35FIELDFIELDFIELD

DBDGENFINISHEND

(SEQ,U): Unique key field(SEQ,M): Non-unique key field

Assignment3:

1. Print pictures of all the database2. Report of DBD used by different program3. PSBwise Report4. DBD by access methods: HISAM, HDAM, and HIDAM. There won’t be Report for

GSAM

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 7 of 85

IMS.MACLIB: Look out in for DBD,SEG FIELD etc. Utility to analyze DBD: ISPF;Option 1 (IMS DBT (DataBase Tools) Manuals) DBDSRC: Contains DBD source DBDLIB: Contains DBD elements

Page 8: IMS-DB-DC

IMS Class Room Session

Hierarchical Sequence

1. Top to Bottom2. Left to Right

IMS puts the segments in this order. If needs to add new segments into the defined sequence, every time that sequence has to be break therefore IMS gives 3 access methods

3. HSAM (Sequential)4. HISAM (Indexed)5. HDAM (Direct)6. HIDAM (Indexed direct)

HSAM

Hierarchical sequential access method (HSAM) databases use the sequential method of accessing data. All database records and all segments within each database record are physically adjacent in storage. An HSAM database can be stored on tape or on a direct-access storage device.

HSAM databases can only be updated by rewriting them. Delete (DLET) and replace (REPL) calls are not allowed, and insert (ISRT) calls are only allowed when the database is being loaded. Although the field-level sensitivity option can be used with HSAM databases. Although the uses of HSAM are limited because of its processing characteristics, it is used for applications requiring sequential processing only. Typically, HSAM is used for low-use files. These are files containing, for example, statistical reports or files containing historical or archive data that has been purged from the main database.

In the data set, a database record is stored in one or more consecutive blocks. You define what the block size will be. Each block is filled with segments of the database record until there is not enough space left in the block to store the next segment. When this happens, the remaining space in the block is padded with zeros and the next segment is stored in the next consecutive block. When the last segment of a database record has been stored in a block, any unused space, if sufficient, is filled with segments from the next database record. In storage, an HSAM segment consists of a 2-byte prefix followed by user data. The first byte of the prefix is the segment code, which identifies the segment type to IMS. This number can be from 1 to 255. The segment code is assigned to the segment by IMS in ascending sequence, starting with the root segment and continuing through all dependents in hierarchic sequence. The second byte of the prefix is the delete byte. Because DLET calls cannot be used against an HSAM database, the second byte is not used.

Initial entry to an HSAM database is through GU or GN calls. When the first call is issued, the search for the desired segment starts at the beginning of the database and passes sequentially through all segments stored in the database until the desired segment is reached. After the desired segment is reached, its position is used as the starting position for any additional calls that process the database in a forward direction.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 8 of 85

Page 9: IMS-DB-DC

IMS Class Room Session

HISAM

Distributes one dataset into two datasets. Is a slowest access method of all. When DBD generation takes place, it suggests space, CI size etc. then accordingly DBA creates the two datasets, KSDS & ESDS

Primary Dataset Overflow Dataset

In a hierarchical indexed sequential access method (HISAM) database segments in each database record are related through physical adjacency in storage. Each HISAM database record is indexed, allowing direct access to a database record. In defining a HISAM database, you must define a unique sequence field in each root segment. These sequence fields are then used to construct an index to root segments (and therefore database records) in the database.HISAM is typically used for databases that require direct access to database records and sequential processing of segments in a database record.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 9 of 85

EMP

EMP

EMP

PR PR SKL

SKL SKL

RBA RBA

RBA

HISAM data-base requires frequent reorganization

Page 10: IMS-DB-DC

IMS Class Room Session

Database Record:

Starting from root to the last dependant is one complete database record.

Logical Record

The logical record is a part of database record, which can be stored in one CI. In a logical record, the first 4 bytes are a direct-address pointer to the next logical record in the database record. This pointer maintains all logical records in a database record in correct sequence. The last logical record in a database record contains zeros in this field. Following the pointer are one or more segments of the database record in hierarchic sequence. Following the segments is a 1-byte segment code of 0. It says that the last segment in the logical record has been reached. HISAM database records are stored in two data sets. The first data set, called the primary data set, contains an index and all segments in a database record that can fit in one logical record. The index provides direct access to the root segment (and therefore to database records). The second data set, called the overflow data set, contains all segments in the database record that cannot fit in the primary data set. A KSDS is the primary data set and an ESDS is the overflow data set.Logical records are grouped into control intervals (CIs). A control interval is the unit of data transferred between an I/O device and storage. You define the size of CIs. Each database record starts at the beginning of a logical record in the primary data set. A database record can only occupy one logical record in the primary data set, but overflow segments of the database record can occupy more than one logical record in the overflow data set. Segments in a database record cannot be split and stored across two logical records. Because of this and because each database record starts a new logical record, unused space exists at the end of many logical records. When the database is initially loaded, IMS inserts a root segment with a key of all X'FF's as the last root segment in the database.

Each logical record in the primary data set contains the root plus all dependents of the root (in hierarchic sequence) for which there is enough space. The remaining segments of the database record are put in the overflow data set (again in hierarchic sequence). The two "parts" of the database record are chained together with a direct-address pointer. When overflow segments in a database record use more than one logical record in the overflow data set the logical records are also chained together with a direct-address pointer. In HISAM, when an application program issue a call with a segment search argument (SSA) qualified on the key of the root segment, the segment is found by: 1. Searching the index for the first pointer with a value greater than or equal to the

specified root key (the index points to the highest root key in each CI)

2. Following the index pointer to the correct CI

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 10 of 85

Page 11: IMS-DB-DC

IMS Class Room Session

3. Searching this CI for the correct logical record (the root key value is compared with each root key in the CI)

4. When the correct logical record (and therefore database record) is found, searching sequentially through it for the specified segment

If an application program issues a GU call with an unqualified SSA for a root segment or with an SSA qualified on other than the root key, the HISAM index cannot be used. The search for the segment starts at the beginning of the database and proceeds sequentially until the specified segment is found.

Picture to be drawn for databaseHow new segments are inserted ? CI split?

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 11 of 85

Page 12: IMS-DB-DC

IMS Class Room Session

Pointers Used in HD database

Types of Pointers You Can Specify:

The hierarchic sequence of segments in a database record using the sequential access methods is maintained by keeping segments physically adjacent to each other in storage. In the HD access methods, segments in a database record are kept in hierarchic sequence using direct-address pointers. Each pointer is 4 bytes long and consists of the relative byte address of the segment to which it points.

Several different types of direct-address pointers exist: Hierarchic pointers, which point from one segment to the next in either forward or forward and backward hierarchic sequence Physical child pointers, which point from a parent to each of its first or first and last children, for each child segment type Physical twin pointers, which point forward or forward and backward from one segment occurrence of a segment type to the next, under the same parent When segments in a database record are typically processed in hierarchic sequence, use hierarchic pointers. When segments in a database record are typically processed randomly, use a combination of physical child and physical twin pointers.

When an application program issues a call for a segment, HF pointers are followed until the specified segment is found. In this sense, the use of HF pointers in an HD database is similar to using a sequentially organized database. In both, to reach a dependent segment all segments that hierarchically precede it in the database record must be examined. HF pointers should be used when segments in a database record are typically processed in hierarchic sequence and processing does not require a significant number of delete operations. If there are a lot of delete operations, hierarchic forward and backward pointers (explained next) might be a better choice. Four bytes are needed in each dependent segment's prefix for the HF pointer. Eight bytes are needed in the root segment. More bytes are needed in the root segment because the root points to both the next root segment and first dependent segment in the database record. HF pointers are specified by coding PTR=H in the SEGM statement in the DBD. Hierarchic Forward and Backward Pointers: With hierarchic forward and backward pointers (HF and HB), each segment in a database record points to both the segment that follows and the one that precedes it in the hierarchy (except dependent segments do not point back to root segments). HF and HB pointers must be used together, since you cannot use HB pointers alone. HF and HB pointers are specified by coding PTR=HB in the SEGM statement in the DBD.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 12 of 85

Page 13: IMS-DB-DC

IMS Class Room Session

Physical Child First Pointers: With physical child first (PCF) pointers, each parent segment in a database record points to the first occurrence of each of its immediately dependent child segment types.

With PCF pointers, the hierarchy is only partly connected. No pointers exist to connect occurrences of the same segment type under a parent. Physical twin pointers (explained later) can be used to form this connection. PCF pointers should be used when segments in a database record are typically processed randomly and sequence fields are either defined for the segment type. If not, new segments are not inserted at the end of all existing segment occurrences. If sequence fields are not defined and new segments are inserted at the end of existing segment occurrences, the combination of PCF and physical child last (PCL) pointers (explained next) can be a better choice. Four bytes are needed in each parent segment for each PCF pointer. PCF pointers are specified by coding PARENT=((name,SNGL)) in the SEGM statement in the DBD. This is the SEGM statement for the child being pointed to, not the SEGM statement for the parent. Note, however, that the pointer is stored in the parent segment. Physical Child First and Last Pointers: With physical child first and last pointers (PCF and PCL), each parent segment in a database record points to both the first and last occurrence of its immediately dependent child segment types. PCF and PCL pointers must be used together, since you cannot use PCL pointers alone. PCF and PCL pointers (as opposed to just PCF pointers) are typically used when: No sequence field is defined for the segment type.

New segment occurrences of a segment type are inserted at the end of all existing segment occurrences.

On insert operations, if the ISRT rule of LAST has been specified, segments are inserted at the end of all existing segment occurrences for that segment type. When PCL pointers are used, fast access to the place where the segment will be inserted is possible. This is because there is no need to search forward through all segment occurrences stored before the last occurrence. PCL pointers also give application programs fast retrieval of the last segment in a chain of segment occurrences. Application programs can issue calls to retrieve the last segment by using an unqualified SSA with the command code L. When a PCL pointer is followed to get the last segment occurrence, any further movement in the database is forward. A PCL pointer does not enable you to search from the last to the first occurrence of a series of dependent child segment occurrences. Four bytes are needed in each parent segment for each PCF and PCL pointer. PCF and PCL pointers are specified by coding the PARENT= operand in the SEGM statement in the DBD as PARENT=((name,DBLE)). This is the SEGM statement for the child being pointed to, not the SEGM statement for the parent. Note, however, that the pointers are stored in the parent segment. A parent segment can have SNGL specified on one immediately dependent child segment type and DBLE specified on another.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 13 of 85

Page 14: IMS-DB-DC

IMS Class Room Session

Coding these pointers in the DBD: DBD SEGM A SEGM B PARENT=((name.SNGL)) (specifies PCF pointer only) SEGM C PARENT=((name.DBLE)) (specified PCF and PCL pointers) Results in these pointers being created: Physical Twin Forward Pointers: With physical twin forward (PTF) pointers, each segment occurrence of a given segment type under the same parent points forward to the next segment occurrence. Note that PTF pointers can be specified for root segments. When this is done in an HDAM database, the root segment points to the next root in the database chained off the same root anchor points (RAP). (RAPs are explained in a following section called "General Format of HD Databases and Use of Special Fields.") If no more root segments are chained from this RAP, the PTF pointer is zero. When PTF pointers are specified for root segments in HIDAM database, the root segment does not point to the next root in the database. What happens is explained in a subsequent section called "Use of RAPs in a HIDAM Database." The important thing for you to know now is that if you specify PTF pointers on a root segment in a HIDAM database, the HIDAM index must be used for all sequential processing of root segments. This increases access time. This problem is eliminated if you specify PTF and physical twin backward (PTB) pointers (discussed next). With PTF pointers, the hierarchy is only partly connected. No pointers exist to connect parent and child segments. Physical child pointers can be used to form this connection. PTF pointers should be used when segments in a database record are typically processed randomly, and you do not need sequential processing of database records. Four bytes are needed for the PTF pointer in each segment occurrence of a given segment type. PTF pointers are specified by coding PTR=T in the SEGM statement in the DBD. This is the SEGM statement for the segment containing the pointer. The combination of PCF and PTF pointers is used as the default when pointers are not specified in the DBD. Physical Twin Forward and Backward Pointers: With physical twin forward and backward (PTF and PTB) pointers, each segment occurrence of a given segment type under the same parent points both forward to the next segment occurrence and backward to the previous segment occurrence. PTF and PTB pointers must be used together, since you cannot use PTB pointers alone. Note that PTF and PTB pointers can be specified for root segments. When this is done, the root segment points to both the next and the previous root segment in the database. As with PTF pointers, PTF and PTB pointers leave the hierarchy only partly connected. No pointers exist to connect parent and child segments. Physical child pointers (explained previously) can be used to form this connection. PTF and PTB pointers (as opposed to just PTF pointers) should be used on the root segment of a HIDAM database when you need fast sequential processing of database records. By using PTB pointers in root segments, database records can be sequentially processed without intervening references to the HIDAM index. PTB

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 14 of 85

Page 15: IMS-DB-DC

IMS Class Room Session

pointers improve performance when deleting a segment in a twin chain accessed by a virtually paired logical relationship. This happens when the delete that causes DASD space to be released occurs on a delete from the logical access path. Eight bytes are needed for the PTF and PTB pointers in each segment occurrence of a given segment type. PTF and PTB pointers are specified by coding PTR=TB in the SEGM statement in the DBD. Mixing Pointers: Because pointers are specified by segment type, the various types of pointers can be mixed within a database record. However, only hierarchic or physical, but not both, can be specified for a given segment type. The types of pointers that can be specified for a segment type are: HF Hierarchic forwardHF and HB Hierarchic forward and backwardPCF Physical child firstPCF and PCL Physical child first and lastPTF Physical twin forwardPTF and PTB Physical twin forward and backward

When a segment is deleted in an HD database, it is physically removed from the database. The space it occupied can be reused when new segments are inserted.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 15 of 85

Page 16: IMS-DB-DC

IMS Class Room Session

HDAM

Defined using one dataset, ESDS or OSAM which is logically divided into 2 parts

RAACIs (Root

AddressibleArea)

Overflow AreaCis

How data is placed ?

IMS provides Randomizing Module (Assembly language module)

Key value (00001) will be the input

Output will be a block number, which will be

Available range. If it is 8, then record gets

Stored into 8th block.

Here there is a problem.

If the block number is duplicated, the record gets stored into same block. Which requires more overhead. Therefore required to choose proper randomizing module and number of RAA blocks.

If segment is deleted that space is available for new segments.

HDAM supports random access. It does not support for sequential access.

HDAM databases are typically used when you need primarily direct access to database records. The randomizing module provides fast access to the root segment (and therefore the database record). HDAM databases also give you fast access to paths of segments as specified in the DBD in a database record. You cannot process HDAM database records in key sequence unless the randomizing module you use stores root segments in physical key sequence.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 16 of 85

00001

Randomizing Module

1968-IMS 1973-VSAM Therefore IMS used OSAM (Overflow Sequential Access Method), ISAM prior to VSAM

KSDS,ESDS

Page 17: IMS-DB-DC

IMS Class Room Session

HIDAM

It makes use of two data-sets, ESDS and KSDS

ESDS KSDS

A HIDAM database is actually composed of two databases. (HIDAM uses an index to get to a specific root segment rather than the root anchor points used by HDAM.) The first database contains the database records as the database. The second database contains the HIDAM index as the index database. Root segments in a HIDAM database must have a unique key field, because an index entry exists for each root segment based on the root's key. When initially loading a HIDAM database, all root segments should be presented to the load program in ascending key sequence, and all dependents of a root should follow the root in hierarchic sequence. Note that HIDAM, unlike HDAM, has no root addressable or overflow area, just a series of blocks or CIs. When database records are initially loaded, they are simply loaded one after another in the order in which they are presented to the load program. The space in Note how segments in a database record are chained together. In this case, hierarchic pointers were used instead of the combination of physical child/physical twin pointers. Each segment points to the next segment in hierarchic sequence. Although HIDAM databases can have RAPs, you probably do not need to use them. As each root is stored in a HIDAM database, IMS creates an index segment for the root and stores it in the index database. The index database consists of a single VSAM KSDS. The KSDS contains an index segment for each root in the database. When initially loading a HIDAM database, IMS will insert a root segment with a key of all X'FF's as the last root in the database.The prefix portion of the index segment contains the delete byte and the root's address. The data portion of the index segment contains the key field of the root being indexed. This key field identifies which root segment the index segment is for and remains the reason why root segments in a HIDAM database must have unique sequence fields. Each index segment is a separate logical record.

Persistent Data Cont’d

Recovery

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 17 of 85

1

5

6

99

Page 18: IMS-DB-DC

IMS Class Room Session

DBRC:- Database Recovery Control

You need to define DBRC for every database. All the recovery process is automatic. Each and every activity is recorded by IMS. DBRC makes use of a log. Whenever changes are made to databases, are stored in log. Using that DBRC does the recovery. It can be semiautomatic that is JCLs are created but not submitted.

DBRC is located in a separate address space. It is invoked by an MVS start procedure command that is issued from the IMS control region. An IMS online system uses this separate address space to contain the DBRC code. Each system must obtain authorization from DBRC before it can access the database, even if the database is not registered for sharing. For area-level sharing, authorization is obtained at the point in the processing when that data resource is requested.

Isolation

IRLM:- IMS Resource Lock Manager or Internal Lock manager. It puts the lock automatically.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 18 of 85

DBRC

DL/I

IRLM

Page 19: IMS-DB-DC

IMS Class Room Session

Automicity of transaction:-

Rolling back the transaction Transaction starts Changes kept in log Transaction completes Changes are made permanent or else changes are undone by IMS if transaction

fails COMMIT releases the locks (Checkpoint)

DB/DC Dictionary:-

Separate product along with IMS, takes care of database management.(catalog service)

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 19 of 85

Page 20: IMS-DB-DC

IMS Class Room Session

Day 4

FUNCTION: ISRTREPLDELTGUGNGNP

IOAREA: Program working storage area used by IMS to store, retrieve data.

SSA: Segment Search Argument. To inform IMS - which segment to work on.

To insert new EMP segment:

1. ISRT2. I/O area to be prepared3. PCB which indicates DB4. Segment Name (EMP)

Programs are users to IMS. IMS always talks to you through program.

PSB

1. Which database to be worked on: EMPDBD2. Which segment to be worked on: 3 segments3. What is the operation; ISRT

IMS won’t allow to perform any other operation, or use any other DBD not specified here. This way you can obtain control on the database operation a program can perform.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 20 of 85

CALL ‘CBLTDLI’ USING FUNCTION PCB

IOAREASSA

Page 21: IMS-DB-DC

IMS Class Room Session

PCB TYPE=DB,NAME=EMPDBD,PROCOPT=I/A/IRD/G/GON/GOT

Once this PSB is ready, you can work on it.Now define the segments of the database. Here there are 3 segments used therefore

SENSEG NAME=___________SENSEG NAME=___________SENSEG NAME=___________

PSBGEN NAME=EMPADD,LANG=COBOL

[SENSEG-Sensitive Segment]

So before writing COBOL program all these things need to prepare.

Note: Use PROCOPT = A

As many no. of PCB = No. Of databases

You can also give restriction at field level that is one particular field only should get modified and not others

PCB --------------SENSEG NAME=EMPSENFLD NAME=EMPNAME::

So here only EMPNAME can be modified. You cannot touch any other field from that segment.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 21 of 85

IMS1.DBDLIB (pds) contains DBD generated. For example: EMPDBD IMS1.PSBLIB (pds) contains PSB generated. For example: EMPADD

Page 22: IMS-DB-DC

IMS Class Room Session

When you execute IMS program, IMS first look for PSB therefore specify program name with PSBname. IMS will create one area by acquiring memory. If there use multiple PCB statements it will create occurrences of that area.

PCBPCBPCBPCBGEN

Program does not start execution, IMS first does its job then program starts execution because JES is not aware of PCB mask.

DBPCB Mask: Definition for this area is defined by IMS. Here only concatenated key length will vary

6 6

115 3 9

22 11

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 22 of 85

Page 23: IMS-DB-DC

IMS Class Room Session

In our case concatenated key will be 12

This entire pcb mask IMS puts into acquired memory.

EMP-PCB-MASK.DBDNAME= ‘EMPDBD’PROCOPT=’A’NO-SEN-SEG=3CONCATENATED-KEY=12

This structure is known as program communication block. So first thing required for executing IMS Program:

1. Create PSB2. Program executed3. IMS creates PCB into its own area & not in program work area. It is created to

inform you about your IMS operation. This is outside the program work area therefore needs to define PCB in linkage section of COBOL program.

In the procedure division you should write as:

PROCEDURE DIVISION USING EMP-PCB-MASK

You are not suppose to change PCB. It is read only. If you try to change it. You will get ABEND for storage violation

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 23 of 85

EMP6

PR6

SKL3

IMSSTORAGE KEY 7

PROGRAMSTORAGE KEY 8

Page 24: IMS-DB-DC

IMS Class Room Session

Lowest key can operate on any high key area. But if higher value key area tries to change anything from low-key area, storage violation will occur & program will ABEND. Even CICS operates at lower level.

In case if you are using two PCBs

PCB EMPDBDPCB PROJDBD

LINKAGE SECTION.01 EMP-PCB-MASK

: This order must match:

01 PROJ-PCB-MASK

PROCEDURE DIVISION should be:

PROCEDURE DIVISION USING EMP-PCB-MASK PROJ-PCB-MASK.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 24 of 85

Page 25: IMS-DB-DC

IMS Class Room Session

Another way of using PCB mask in Procedure Division:-

PROCEDURE DIVISION.ENTRY ‘DLICBLT’ USING EMP-PCB-MASK………..(AMEX Standard)

DFSRRC00Execute DFSRRC00 program to execute your IMS cobol program. You just can’t

directly executes your Program.

EXEC PGM=DFSRRC00.PGMNAME=EMPADD PSBNAME=EMPPSB……………..

It first loads PCB-mask into memory & then it will load your program into memory. Then it passes Address of PCB-mask to the program.

Assignment4:

1. Create test data2. Write DBD for EMP, PROJECT and PSB in one single .ACB file. Keep PROCOPT = A3. Invoke CAISUTIL

Day 5

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 25 of 85

01 INVENTORY-PCB-MASK.05 DBD-NAME X(08).05 SEGMENT-LEVEL X(02).05 STATUS-CODE X(02).05 PROC-OPTIONS X(04) This will be always same05 FILLER S9(05) COMP05 SEGMENT-NAME X(08)05 KEY-LENGTH S9(05) COMP05 NUMB-SENS-SEGS S9(05) COMP05 CONCAT-KEY X(11)

This will change as per the segment level

Segment can have only one SEQ field If field is SEQ and you are looking out for 16. It will stop search when it reaches 17. It

won’t search beyond that. Whereas if the field is SEARCH field, it will search all the records. Therefore slower

performance

Page 26: IMS-DB-DC

IMS Class Room Session

In DBDGEN, fields defined using FIELD other than SEQ field are SEARCH fields. Only these fields you can use in SSA. Rules are coded for segment having SEQ field but which is non-unique. Still IMS needs to arrange it in order.

Give it as (SEQ, M)

This is non-unique so duplicates are allowed.

Type Of CALL

1. Unqualified CALL If CALL statement does not include SSA then that CALL is unqualified CALL.

2. Qualified CALL If SSA is specified in a CALL, it is qualified CALL.

Type Of SSA

CALLS

1. GET UNIQUE

Function Code: ‘GU ‘

Functions:

Used to retrieve a segment Used for random access

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 26 of 85

Qualified SSA

Containing segment name with some qualification

Example:

EMP (EMPNO EQ 123456)

Unqualified SSA

Contains just segment name

Example:

INSRT EMP

Unqualified Call GU-------------------------------------------------(A)GU EMPSEGGU EMPSEG

Qualified Call PRSEGGU PRSEG----------------------------------(B)GU SKLSEG--------------------------------(E)

Qualified SSA GU EMPSEG (EMPNO=123456)--------(H)

Page 27: IMS-DB-DC

IMS Class Room Session

(A) will give first root occurrences. If SSAs are missing for any level, then IMS assumes unqualified SSA for that level. It is equivalent to GU EMPSEG. IMS always starts search in hierarchical sequence.

Return Code:

GE: Segment not foundBlank: Segment found

2. GET NEXT (Sequential Processing)

Function Code: ‘GN ‘

Function: Used to retrieve next sequential segment

CALL SEGMENT RETRIEVED

RETURN CODE COMMENT

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 27 of 85

SKLSEG F02JAVA

PRSEG D 200102PRSEG C

200101

EMPSEG G 234562

G F

D C

HA EMPSEG

BPRSEG

ESKLSEG

EMPSEG A123456

PRSEG B200012

SKLSEG E01CICS

Page 28: IMS-DB-DC

IMS Class Room Session

GU A BLANK EMPSEG (123456)GN B BLANK MOVED AT LOWER

LEVELGN C BLANKGN D BLANKGN E GK MOVED AT SAME

LEVEL BUT DIFFERENT SEGMENT

GN F BLANKGN G GA MOVED AT HIGHER

LEVEL

Now suppose if you want to retrieved skill-id 01 of first employeeThen you need to code following:

GU EMPSEG (EMPNO=123456)GN SKLSEG

OR

GN SKLSEG(SKLID=01)But what if you want to retrieve particular segment for all the employees.Say, For each employee print payroll record.

So for this is use GNP call.

GNP: Get Next Within Parent. GU or GN call establishes parentage. If want to use GNP, first you have to use GU or GN to establish parent.

Scope of GNP: All the dependents of the particular parent.

GU EMPSEGGNP SKLSEG

Will retrieve all the skill segments under that employee. When skill segment will end for that employee, you will get return code of GE.

3. Replace and Delete Call

Function Code: ‘REPL ‘ and ‘DLET’

Function: Used to replace and delete the specified segment

1] Read With Hold is necessary before you work on with these calls

GHU, GHN, GHNP

2] While replacing, key portion cannot be modified

3] For delete call do not move anything into segment area.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 28 of 85

Page 29: IMS-DB-DC

IMS Class Room Session

4] Once EMP segment is deleted all the dependents of this segment will get deleted.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 29 of 85

GHU EMPSEG (EMPNO=123456)

DLET

(here no need to specify qualification, it will work on old call)

GHU EMPSEG (EMPNO=123456)MOVE ………………………..DLET

(here it will give return code ‘DX’)

Page 30: IMS-DB-DC

IMS Class Room Session

5] Some other formats you can use:

REPL & DLET must be preceded by HOLD call. Otherwise IMS will give you the return code ‘DA’, ‘DJ’

Status codes you can expect during sequential processing

Status Code DescriptionBlank Blank in the PCB status code after GN or

GNP call indicates that the call was successful

GE Segment not foundGB Can occur with GN but not with GNP call.

It indicates that you’ve tried to retrieve a segment, but are at the end of database. It is like AT END condition raised during COBOL READ statement.When you reach the end of database with GNP call, DL/I returns the GE status code.

GA When an unqualified GN or GNP call moves to upper level in the hierarchy to retrieve a segment

GK Raised by unqualified GN or GNP at same hierarchical level but different segment.

GP GNP is given before establishing a parentage

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 30 of 85

GHU EMPSEG(EMPNO=123456)

GHN PRSEG---*L go for last PRSEG

*F go for first PRSEG

DLET

* indicates Command Code Follows Three spaces

Page 31: IMS-DB-DC

IMS Class Room Session

Day 6

Application Control Block

Hierarchical access method is a general purpose routine But we don’t want all the routines to be run We need to have customized version of Hierarchical Access Method So to customize this use PROCOPT

Restrict and Provide access requires buffers. Access Method cannot work direct with PSB. ACB is the combined version of PSB and DBD. Buffer creation for DBD segments is done by use of ACB.

In a mainframe, under batch mode i.e. DL/I environment. IMS initialization needs to be done before program starts execution.

EXEC PGM=DFSRRC00 PARM (DL/I,………………………….)

In DL/I batch mode, generation of ACB is dynamically invoked. DFSRRC00 looks PSB & take corresponding DBD and create the ACB block & then create PCBs. After this it gives control to your program and then the execution starts.

If this facility is available in batch DL/I, then why it is not in Online?Why in Online, ACB block generation is required?

Since in Online programs response time is critical therefore instead of creating it dynamically it is generated first. Each program triggers ACB generation therefore in Online it is generated first. It is a separate entity stored in ACBLIB.

Summary:-In DL/I-ACB creation is dynamic (Using DFSRRC00 in RUN JCL)

In Online -ACBGEN is required (Saves Time)

Also in DBB (newer version)-ACBGEN is required

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 31 of 85

In DBBATCH (newer version) in batch environment (PARM=(DBB,…..)), ACB should be generated in advance like online

Assembly language code routines are stored as a member of SYS1.RESLIB Find out how many members are present in ACBLIB Whether many PSB can reside in one ACB?

Page 32: IMS-DB-DC

IMS Class Room Session

IMS/DC

Service Architecture

Example: Knowledge-ware Co.

Experts Home

Library Call to Expert Cupboard for

Blank Forms

Forms to be processed

Blank form ------(II)Filled in form---(III)

User—(I)

Reception slots

DeliveryUser

Delivery TrayForms to be delivered

Data Layer Business Layer Presentation Layer

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 32 of 85

Tools Process Reception

Data Layer

Business Layer Presentation Layer

User

User

User

ManagerP C M A

PCM

A

ReceptionPhy

Mathss

Books

Manuals

Periodicals

Ref. Papers:::::

Page 33: IMS-DB-DC

IMS Class Room Session

Reception Responsibilities:

1. Provide Blank forms2. Accept filled in forms3. Deliver reply

Experts are ‘on call’ experts

Physics and Astrophysics are high priority jobs

Manager will take decision based on

1. Priority2. Resources (No. of cabins)3. Load

If it is just one request, You may not call expert. You will have a policy for when to call expert.

Expert Work Flow

1. Take form2. Process reply-after-referring-library3. Put into delivery tray4. Repeat step 1 thru 3 until no request5. Go Home

IMS/DC or IMS/TM

Programs Home

Qmanager

In UserUserUser/FOR PHY

Out

MFS looks for physics form in MFSLIB and gives it to user.

Who will design the physics forms?Total 4 forms to be designed and kept in MFSLIB.

User will enter data in physics form and presses enter. Now MFS will put this in QMGR.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 33 of 85

Control Region

MPP Region

MPP Region

Out

MFS

MFSLIBIMS/DB

IMS/DM

PGMLIB

We need to provide these blank forms. Same as CICS BMS maps

Page 34: IMS-DB-DC

IMS Class Room Session

Managers Work Sheet:

Requirement Priority Program AddressPhysics 2 Phy pgm. ------Chemistry 3 Che pgm. ------Maths 4 Math pgm. ------Astrophysics 1 Astro pgm. ------

Manager will call associated program depending on the priority given. IMS is not aware of this worksheet. So somebody has to inform that there are different forms, with associated experts.

Once Program is loaded, it will take forms from QMGR until no more forms.

Pseudocode for subject matter expert work flow:

Receive FormPerform Process Until no-more-formGo back

Process.Find the required informationSend form with detailsReceive form

Day 7

EMPO

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 34 of 85

Worksheet is provided by you. Same as CICS PPT table entry

EMPADD

EMPNO: _______

EMPNAME: _______

ADDRESS: _______

Page 35: IMS-DB-DC

IMS Class Room Session

/FOR EMPO

MFS will pick up EMPO from MFSLIB and send it to terminal. User will enter details and form goes to QMGR when user presses ENTER.There should be identification form each form. So accordingly it gets stored in QMGR. ‘n’ number of users can invoke same form to enter details.

8 characters transaction-id is associated for each screen.

Control region provides this facility of system definition. It uses 2 macros1. Transact2. Applctn

After typing transaction id at the terminal, program is loaded into memory & starts execution.

If any program fails, IMS provides transaction support to undo all changes. Control region provides a log where IMS writes.

All the entries like pgm1 start, pgm2 start ,empadd delt are stored into log.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 35 of 85

Terminology CICS IMSQuasi-reentrancy Serial reusability

Memory Disk Tape

Page 36: IMS-DB-DC

IMS Class Room Session

When transaction is under execution, changes are put into memory.All requests go through control region. So that in case of failure control region undo the changes.That’s how control region keeps track of all database changes. Program should not directly talk to database. It should be thru control region. If program 2 fails control goes back to control region. It will look out for the changes in the log for program 2 and undo the changes. Therefore IMS provides atomicity to undo the changes. IMS talks to database on behalf of program

Isolation is available by IRLM. At the time of IMS generation, select :

1. IMS Component Program Isolation Manager (In-built) or IRLM2. DBRC Yes/No

While testing your program in batch DL/I mode, DBRC is N. Because here you are working on dummy databases or copy of databases. You are not working on real databases. Therefore DBRC is not required over here. Here databases are used for the creation of test data. If anything fails you just have to reload the data & start again. Therefore DBRC is ‘N’ here. In real application it must be ‘Y’.

QMGRUsers

Above environment is a normal environment, which run during office time (9-6)

You run batch program during off time i.e. after 6 pm.

So during office time, control region will take charge of all the database. If you try to use any database for batch job, you won’t get exclusive control over it since control region is having exclusive control on all the databases. Therefore you have to use this database for batch job after 6pm.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 36 of 85

IRLM DBRC DL/I CR

IMS/DBPGM1

PGM 2

PGM 3

MFS

Page 37: IMS-DB-DC

IMS Class Room Session

But if online environment uses databases for 24 hours, when the batch job will run?-Needs to put this batch job into memory.

Memory Qmgr

In a queue all messages gets accumulated & then once in a day or so get processed by batch program. This won’t have trans-id associated to any program. Control region won’t schedule for this.

There are two types of BMP:- 1. Transaction Oriented BMP2. Batch Oriented BMP

Process

1. MPP: Immediately2. BMP-Transaction:

Defer-Accumulate(accumulated into queue & processed by batch pgm)-Process

When?1 day, 1week, 1 month: depends on Business needs

3. BMP-Batch:Accumulated by somebody-fileHere events are captured by third party and given to us as files

Databases are always in shared mode, therefore we have to use BMP.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 37 of 85

DL/I CR

MPP pgm1

MPP pgm2

MPP pgm3

MPP pgm4

BMP pgm1

Page 38: IMS-DB-DC

IMS Class Room Session

IBM Terminal

IBM terminals are 3270 compliant. Attention identifiers for this terminal type are as follows:

1. Enter2. PF1 to PF243. PA1 to PA34. CLEAR

Attribute byte precedes every field on screen. NMDS: Native Mode Data stream format. Attributes, fields and extended data

characteristics, positions etc. is given here. NMDS is understood by terminals & it displays the data on 3270 terminal format While sending

NMDS = Mydata + Device Characteristics While receiving

Mydata = NMDS – Device Characteristics + the AID key pressed So if you see Device Characteristics in common in both the operations. Therefore

it is good to use common utility which will work on terminal characteristics and Mydata. This process in IMS is done by MFS

Screen Definitions(Fields & attributes)

Mydata

Mydata + Aid Key

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 38 of 85

MFS

ABC Company

Empno: Name :

Page 39: IMS-DB-DC

IMS Class Room Session

Day 8

Data + Format + Device Characteristics Terminal

24,80 : Terminal type (3270,2)

Format:

1. Position2. Attribute3. Initial Value4. Length

Format, device characteristics and AID key pressed this information you should give to IMS.

Attributes:

PROT HI MOD ALPHAUNPROT NORM NOMOD NUM

NODISP

Note:

1. Keep all the fields on screen as ALPHA only. In a program you take care of numeric and decimal place etc. validation are done in program only.

2. After pressing AID key, terminal hardware will send back only modified fields. It keeps track of it by one bit in attribute byte, which is MOD or NOMOD.

3. CLEAR, PA1 to PA3 keys have special meaning for IMS. Data is not transmitted for these keys. Only IMS works on these keys.

Following is a EMPADD.MFS code:

PRINT NOGEN If you give ‘00C0’, all the fields are cleared TITLE 'ADD EMP SCREEN' before sending the screen to the terminal.

***********************************************************************ADDEMP FMT DEV TYPE=(3270,2), X

FEAT=IGNORE, X

SYSMSG=MESG2, Only unprotected fields X DSCA='00A0', are cleared X

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 39 of 85

Application Programming Transaction Manual contains information about devices under 3270 category with full syntax.

Page 40: IMS-DB-DC

IMS Class Room Session

PFK=(PFKFLD2,'01','02','03','04','05','06','07','08', X '09','10','11','12','13','14','15','16','17','18','19', X '20','21','22','23','24')

DIV TYPE=INOUT DPAGE CURSOR=((8,35)), X FILL=PT DFLD 'SYNTEL EMPLOYEE SYSTEM', X POS=(2,21), X ATTR=(PROT,ALPHA,HI,NOMOD) DFLD '**********************', X POS=(3,21), X ATTR=(PROT,ALPHA,HI,NOMOD) DFLD 'ADD EMPLOYEE', X POS=(5,27), X ATTR=(PROT,ALPHA,HI,NOMOD) DFLD '------------', X POS=(6,27), X ATTR=(PROT,ALPHA,HI,NOMOD) DFLD 'EMP NO: ', X POS=(8,22), X ATTR=(PROT,ALPHA,HI,NOMOD)

EMPNO DFLD POS=(8,35), X LTH=6, X ATTR=(UNPROT,ALPHA,NORM,MOD) DFLD 'EMP NAME: ', X POS=(10,22), X ATTR=(PROT,ALPHA,HI,NOMOD)

EMPNAME DFLD POS=(10,35), X LTH=30, X ATTR=(UNPROT,ALPHA,NORM,MOD) DFLD 'EMP ADDRESS: ', X POS=(12,22), X ATTR=(PROT,ALPHA,HI,NOMOD)

EMPADDR DFLD POS=(12,35), X LTH=40, X ATTR=(UNPROT,ALPHA,NORM,MOD) DFLD 'PF3 - BACK TO MENU ENTER - TO PROCESS', X POS=(22,21), X ATTR(PROT,ALPHA,HI,NOMOD)

MESG2 DFLD POS=(23,2), X LTH=79, X ATTR=(PROT,ALPHA,HI,NOMOD)

FMTEND*ADDI MSG TYPE=INPUT, X

SOR=(ADDEMP,IGNORE), X NXT=ADDO SEG ENTER key MFLD ‘MFSTRN02', X LTH=8 MFLD (PFKFLD2,'00'), X LTH=2 MFLD EMPNO, X LTH=6, X

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 40 of 85

Page 41: IMS-DB-DC

IMS Class Room Session

JUST=R, X FILL=C'0'

MFLD EMPNAME, X LTH=30, X JUST=R, X FILL=C' ' MFLD EMPADDR, X LTH=40, X JUST=R, X FILL=C' ' MSGEND

*ADDO MSG TYPE=OUTPUT, X

SOR=(ADDEMP,IGNORE), X NXT=ADDI SEG When ATTR=YES, length is increased by 2 bytes MFLD EMPNO, X LTH=8, X ATTR=YES MFLD EMPNAME, X LTH=32, X ATTR=YES MFLD EMPADDR, X LTH=42, X ATTR=YES MFLD ERRMSG, X LTH=79 MSGEND END

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 41 of 85

Page 42: IMS-DB-DC

IMS Class Room Session

COBOL Copy Book

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 42 of 85

01 INPUT-MSG.05 INPUT-LL PIC S9(03) COMP.05 INPUT-ZZ PIC S9(03) COMP.05 INPUT-TRAN PIC X(08).05 INPUT-PFKEY PIC X(02).05 INPUT-NO PIC X(06).05 INPUT-NAME PIC X(30).05 INPUT-ADDR PIC X(40).

01 OUTPUT-MSG.05 OUTPUT-LL PIC S9(03) COMP VALUE +165.05 OUTPUT-ZZ PIC S9(03) COMP VALUE +0.05 OUTPUT-NO-ATTR PIC X(02).05 OUTPUT-NO PIC X(06).05 OUTPUT-NAME-ATTR PIC X(02).05 OUTPUT-NAME PIC X(30).05 OUTPUT-ADDR-ATTR PIC X(02).05 OUTPUT-ADDR PIC X(40).05 OUTPUT-MESG1-ATTR PIC X(02).05 OUTPUT-MESG1 PIC X(79).

Page 43: IMS-DB-DC

IMS Class Room Session

Day 9

How DD statements for databases are given?

Take DD names from DBDGEN & dataset names (physical names) from DBA.If you want to test the DL/I program, you allocate dataset for yourself, you cannot use production dataset. Populate the dataset from production dataset records.

STEPLIB DDpoints to IMS.RESLIB, which contains the IMS nucleus and required action modules. It must be authorized. PROCLIB DDpoints to IMS.PROCLIB, which contains all cataloged procedures and jobs for IMS. SYSUDUMP DDdefines a dump data set. This DD statement is optional. The following DD Statements are optional, depending upon your particular requirements. DFSCTL DDcontains the SETR and/or SETO statements to specify the processing options and ranges required at scheduling time. The SETO (SET Options) statement provides the ability to set the processing options to control the execution of HSSP. The SETR (SET Range) statement is used to restrict access to specified parts of a DEDB.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 43 of 85

Find out database/dataset, psb-name naming standards. (I) Get the list of production database & corresponding datasets.(Take help of DBA or onsite

person) (II) You want to test a program so you should know which datasets you are using. For this refer

to PSBGEN for the program A. Get the dataset namesB. Using list (II) datasets as model, allocate datasets for test. (Use File-Aid). So using this

empty dataset will get allocatedC. Load test data using

A. MTDB. Select some data segments from the production dataset i.e. extract records from

production using file-aid. But tests data?We don’t know whether it covers all the conditions or not. If you modify this test data, then it should be updated elsewhere. It might be using secondary index etc. Therefore it is not a reliable method of creating test data.

C. Rexx routine for test data. DD names & dataset names are given in test JCL.

Page 44: IMS-DB-DC

IMS Class Room Session

DFSSTAT DDdefines a data set describing DB call and buffering activity during an application's execution. The reports are written when the application terminates. If you are interested in receiving //DFSSTAT reports, include a //DFSSTAT DD statement in this procedure. An example of this statement follows: //DFSSTAT DD SYSOUT=A For more information on these reports, see IMS/ESA Database Administration Guide. IMS DDAdd an IMS DD statement for IMS.PSBLIB, concatenated with IMS.DBDLIB, if GSAM databases are accessed by the batch application. The statements are: //IMS DD DSN=IMS.PSBLIB,DISP=SHR // DD DSN=IMS.DBDLIB,DISP=SHR The PSB for the batch application program must be contained in the IMS.PSBLIB, and the DBDs for the GSAM databases referenced by the PSB must be contained in the MS.DBDLIB. DFSESL DDWhen the SSM parameter is specified (or defaulted to by specification in the control region), the subsystem libraries, which must be APF authorized, must be available to this region. If JOBLIB/STEPLIB/LINKLIST concatenation is not authorized, you must use the DFSESL DD statement. For online IMS regions, the subsystem library or libraries must be concatenated after the library containing the IMS modules (usually IMS.RESLIB). When multiple subsystems are connected, additional subsystem data sets can be concatenated.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 44 of 85

Page 45: IMS-DB-DC

IMS Class Room Session

Thru’ Control region

DatabaseCall

No JCL

No JCL Database Call

JCL

Here how you get the dataset names and ddnames?

All the databases information is available with control region therefore the dd statements should be known to control region for BMP programs.

We are not required to give ddnames & datasets names since they are available with IMS control region.

IMS program Execution

1. Log on to IMS region2. IBM screen will be in front of user3. Inform about Transaction-id of MENU program4. Screens

EMPMENUI EMPMENUO EMPADDI EMPADDO EMPLISTI EMPLISTO

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 45 of 85

Transaction Log

DL/I CR

MPP

MPP

BMP

Page 46: IMS-DB-DC

IMS Class Room Session

What will happen when following is typed in:

1. /FOR EMPMNUO

(III)

IMS (II)

(I)

2. EMPMNUO

Check for valid transaction id.

3. EMPTRN01 Valid Transaction Id. LL, ZZ, EMPTRN01 (total 12 bytes) Message is created in queue with length 12, rest all will be spaces. Program associated with EMPTRN01 will be started by IMS and

program will display a sreen.

User System

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 46 of 85

/FOR EMPMNUO

MFSLIB

MFS MENU

1. ADD2. INQUIRY

Control Region

Qmgr

MFS/ EMPMNUO

Unknown Transid

Page 47: IMS-DB-DC

IMS Class Room Session

(I) Transaction Id

If PF1 is Pressed (IV)

Queue

GET REQUEST 01 request (II) LL ------ 12 ZZ ------ 0 12 bytes EMPTRN01

SEND MENU Screen (III)

LL ------ 14 ZZ ------ 0 14 bytes EMPTRN01 01

GET REQUEST 01 request (V) LL ------ 14 ZZ ------ 0 14 bytes EMPTRN01 01(VI) Program validates key pressedif key is valid transfer control to respective programelse display error message on screen

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 47 of 85

LL ZZ EMPTRN01

EMPPGM01

MenuPf1: AddPf2: Inquiry:

LL ZZ ……………… 01

Page 48: IMS-DB-DC

IMS Class Room Session

There are four major actions involved in this processing

1. get request2. display screens3. transfer4. analyze

MOVE ‘ANALYZE’ TO NEXT-ACTION.PERFORM PROCESS-REQUEST THRU PROCESS-REQUEST-EXIT

UNTIL EOT.

PROCESS-REQUEST SECTION.IF NEXT-ACTION = ‘ANALYZE’

PERFORM ANALYSIS THRU ANALYSIS-EXITELSE

IF NEXT-ACTION = ‘TRANSFER’PERFORM TRANSFER THRU TRANSFER-EXIT

ELSEIF NEXT-ACTION = ‘REPLY-BACK’

PERFORM REPLY-BACK THRU REPLY-BACK-EXITELSE

ERRRO (ABEND) ON PC GIVE DIVIDE 1 BY ZERO TO ABEND

PROCESS-EXIT.EXIT.

ANALYSIS SECTION.Check for LL field.IF LL-INPUT = 12

MOVE SPACES TO ERRMSGMOVE ‘REPLY-BACK’ TO NEXT-ACTIONGO TO ANALYSIS-EXIT.

IF LL-INPUT = 14IF invalid PF key

MOVE ‘INVALID KEY’ TO ERRMSGMOVE ‘REPLY BACK’ TO NEXT-ACTIONGO TO ANALYSIS-EXIT.

IF PFKFLD = ‘01’MOVE ‘EMPADD’ TO WS-PGM-NAME

ELSEIF PFKFLD = ‘02’

MOVE ‘EMPLIST’ TO WS-PGM-NAMEELSE

MOVE ‘TRANSFER’ TO NEXT-ACTION.ANALYSIS-EXIT.

EXIT.Get Unique Call

Call ‘CBLTDLI’ GUIO-PCBINPUT-MSG-AREA.

All system service call works with IO-PCB

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 48 of 85

Page 49: IMS-DB-DC

IMS Class Room Session

If IO-STATUS-CODE-PCB = ‘QC’ Move ‘y’ to no-more-mesg

Else If IO-STATUS-CODE-PCB NOT = ‘QC’ AND NOT = SPACES

CALL error routine End-if

End-if

Call ‘CBLTDLI’ ISRTIO-PCBOUTPUT-MSG-AREA.

Check for blank status code.

Move ‘y’ to end-of-transaction.

IO-PCB

Alternate PCB

PSBs should have a PCBs in the following order:

1. IO-PCB2. ALTERNATE-PCBs3. DB-PCBs4. GSAM-PCBs

An Online programs get IO-PCB automatically. Therefore BMP programs will get IO-PCB automatically.

Note: For Realia, in .ACB file add following statement:

PCB TYPE=TP,MODIFY=YES PSBGEN NAME=…………………………………………

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 49 of 85

01 IO-PCB.05 IOPCB-LTERM PIC X(08).05 FILLER PIC X(02).05 IOPCB-STATUS-CODE PIC X(02).05 IOPCB-JULIAN-DATE PIC S9(07) COMP-3.05 IOPCB-TIME-OF-DAY PIC S9(07) COMP-3.

05 IOPCB-MSG-SEQ PIC S9(07) COMP.05 IOPCB-MOD-NAME PIC X(08).05 IOPCB-USER-ID PIC X(08).

01 TRANSFER-PCB. 05 TRANSFER-LTERM PIC X(08). 05 FILLER PIC X(02). 05 TRANSFER-STATUS-CODE PIC X(02).

Page 50: IMS-DB-DC

IMS Class Room Session

Day 10

Secondary Index

When DBA designs the databases they design them on the basis of certain application needs. They will come up with the segments, fields, key fields & the structure of the database. However the designed structure may not be suitable for all applications. One may need to view the data using different view.

Secondary indexing enables the application to design their own data structure. Secondary indexing is a solution to the different processing requirements of

various applications. It allows you to have an index based on any field in the database, and not just the key field in the root segment.

Secondary indexes can be used with HISAM, HDAM, and HIDAM databases. A secondary index is in its own separate database and must use VSAM as its access method. Because a secondary index is in its own database, it can be processed as a separate database.

Secondary indexes are invisible to the application program. When an application

program needs to do processing using the secondary index, this fact is communicated to IMS by coding the PROCSEQ= parameter in the PCB. If an application program needs to do processing using the regular processing sequence, PROCSEQ= is simply not coded. If the application program needs to do processing using both the regular processing sequence and the secondary index, the application program's PSB must contain two PCBs, one with PROCSEQ= coded and one without.

When two PCBs are used, it enables an application program to use two paths into

the database and two sequence fields. One path and sequence field is provided by the regular processing sequence, and one is provided by the secondary index. The secondary index gives an application program both an alternative way to enter the database and an alternative way to sequentially process database records.

A final characteristic of secondary indexes is that there can be 32 secondary indexes for a segment type and a total of 1000 secondary indexes for a single database.

Concatenated Key: Used in HISAM, HDAM, HIDAM. Pointer is a number, which is used to reference a particular segment. To get employee information for particular skill then you will use empno and skillid as a concatenated key. If concatenated key is used as pointer then all the keys involved in that concatenated key must be unique.

RBA: Another way of locating segment. Can be used in HDAM and HIDAM. For HISAM use Concatenated Key. In HISAM RBA is not fix. It changes as new split takes place in control interval therefore RBA value changes accordingly therefore in HISAM you cannot use RBA to locate a segment. Whereas in HIDAM, the RBA remains unchanged.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 50 of 85

Page 51: IMS-DB-DC

IMS Class Room Session

IMS Terminology

Symbolic (Concatenated Key).Direct (RBA). This is more efficient but has restriction of not being used for HISAM.

GU EMP (ENAME EQ ABC)

All search fields can also be used to qualify a segment but here performance as compared to sequence field will be lowered, because it will scan all the root segment occurrences till it finds ename ABC.

Search field cannot be used to produce a list in ascending order of the search field.

In VSAM the solution for this is ‘Alternate Indexes’.

So we need to define another index on NAME. In IMS it is referred as Secondary Index.

If there are more employee with same name!IMS resolves this problem by introducing another ESDS file. So Secondary index is KSDS plus ESDS file.

+

All other pointers pointing to that name.

In IMS all things are in terms of database therefore you need to define secondary index database. Index database will be a root only database, which contains search field and pointer

If search field is not unique, another dataset gets added to this database and together this is your secondary index database.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 51 of 85

NAME PTR 1 2 3 ………………….

NAME PTR

Page 52: IMS-DB-DC

IMS Class Room Session

KSDS ESDS

First Match Second Match and so on

Here there is delay in access therefore IMS does not recommend to keep secondary index as nonunique. Which is not practical. IMS provides some mechanism for making Index key unique.

1. Indexed field can be made of (up to) 5 fields in any order i.e. index can be built on combination of multiple fields.

2. You can add upto 5 fields as sub-sequence fields. But IMS will look for main index field only. Even programmers will see just NAME field only. Sub-sequence fields are not visible to program. IMS uses them to make key unique and avoid overhead of ESDS.

For IMS

For programmer

Here duplicates are not avoided but now they are stored into one dataset therefore reduced overhead. As a programmer you don’t have access to sub-sequence field.

Programmer has to take care of duplicates.

3. Inspite of using subsequence field, you cannot guarantee to make key unique, So IMS uses system related field: /SX (direct Pointer) and /CK (Concatenated Key)

/SX: IMS uses index field and RBA (HDAM,HIDAM)/CK: IMS uses index field and concatenated field (HISAM, HDAM, HIDAM)

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 52 of 85

NAME PTR PTR PTR PTR …………..

Database

NAME Sub-seq-field PTR

Page 53: IMS-DB-DC

IMS Class Room Session

Some Terminology in Secondary Indexes:

Target Segment:One, which is retrieved using secondary index.

Source Segment:One, which supplies values for secondary index.

Pointer Segment:One, which stores supplied key value and pointers to target segment.

For example:

Secondary Index: ENAMESource Segment: EMPSEGTarget Segment: EMPSEGPointer Segment: Index database segment

Target and source segment need not be same.

If we want to build secondary index on skill then create skill-id secondary index. Here again many employees will have same skill-id.

If used /CK

Secondary Index: SKILLIDSource Segment: SKLTarget Segment: EMPSEGPointer Segment: Index database segment, which is rootonly

To employee

Will be of SKL segment empid + sklid

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 53 of 85

Skill-id CK PTR

Page 54: IMS-DB-DC

IMS Class Room Session

Assignment:

Secondary Index: Name

PRINT NOGEN DBD NAME=EMP-DBD,ACCESS=(HISAM,ISAM) DATASET DD1=PRIME,OVFLW=OVERFLOW,DEVICE=3350

SEGM NAME=EMP,PARENT=0,BYTES=76 FIELD NAME=(EMPNO,SEQ,U)BYTES=6,START=1,TYPE=C FIELD NAME=EMPNAME,BYTES=30,START=7,TYPE=C FIELD NAME=EMPADR,BYTES=40,START=37,TYPE=C FIELD NAME=/CK1,BYTES=6 LCHILD NAME=(NAMESEG,NAMEDBD),POINTER=INDEX XDFLD NAME=XNAME,SEGMENT=EMP,SRCH=EMPNAME,SUBSEQ=/CK1 SEGM NAME=PAYROLL,PARENT=EMP,BYTES=12 FIELD NAME=(PRYYYYMM,SEQ,U),BYTES=6,START=1,TYPE=C FIELD NAME=PAYAMT,BYTES=6,START=7,TYPE=C

SEGM NAME=SKILL,PARENT=EMP,BYTES=35 FIELD NAME=(SKILLID,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=SKILLNAME,BYTES=30,START=4,TYPE=C FIELD NAME=EXPYRS,BYTES=2,START=34,TYPE=C

DBDGEN FINISH

DBD NAME=NAMEDBD,ACCESS=(HISAM,ISAM) Name DATASET DD1=PRIME,OVFLW=OVERFLOW,DEVICE=3350

Name=30,No.=6 SEGM NAME=NAMESEG,PARENT=0,BYTES=36 If /SX then bytes=34, 30+4 FIELD NAME=(SECNAME,SEQ,U),BYTES=36,START=1,TYPE=C LCHILD NAME=(EMP,EMP-DBD),INDEX=XNAME,POINTER=SNGL RBA DBDGEN FINISH

END

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 54 of 85

Page 55: IMS-DB-DC

IMS Class Room Session

Secondary Index: Name, Skill-Name

PRINT NOGEN DBD NAME=EMP-DBD,ACCESS=(HISAM,ISAM) DATASET DD1=PRIME,OVFLW=OVERFLOW,DEVICE=3350

SEGM NAME=EMP,PARENT=0,BYTES=76 FIELD NAME=(EMPNO,SEQ,U)BYTES=6,START=1,TYPE=C FIELD NAME=EMPNAME,BYTES=30,START=7,TYPE=C FIELD NAME=EMPADR,BYTES=40,START=37,TYPE=C FIELD NAME=/CK1,BYTES=6 FIELD NAME=/CK2,BYTES=9,START=1 LCHILD NAME=(NAMESEG,NAMEDBD),POINTER=INDEX XDFLD NAME=XNAME,SEGMENT=EMP,SRCH=EMPNAME,SUBSEQ=/CK1 LCHILD NAME=(SKILLSEG,SKILLDBD),POINTER=INDEX XDFLD NAME=XSKILL,SEGMENT=SKILL,SRCH=SKILLNAME,SUBSEQ=/CK2 SEGM NAME=PAYROLL,PARENT=EMP,BYTES=12 FIELD NAME=(PRYYYYMM,SEQ,U),BYTES=6,START=1,TYPE=C FIELD NAME=PAYAMT,BYTES=6,START=7,TYPE=C

SEGM NAME=SKILL,PARENT=EMP,BYTES=35 FIELD NAME=(SKILLID,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=SKILLNAME,BYTES=30,START=4,TYPE=C FIELD NAME=EXPYRS,BYTES=2,START=34,TYPE=C DBDGEN FINISH DBD NAME=SKILLDBD,ACCESS=(HISAM,ISAM) DATASET DD1=PRIME,OVFLW=OVERFLOW,DEVICE=3350

SEGM NAME=SKILLSEG,PARENT=0,BYTES=39 FIELD NAME=(SECSKILL,SEQ,U),BYTES=39,START=1,TYPE=C LCHILD NAME=(SKILL,EMP-DBD),INDEX=XSKILL,POINTER=SNGL DBDGEN FINISH

END

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 55 of 85

Page 56: IMS-DB-DC

IMS Class Room Session

How to inform IMS about Secondary Index?

LCHILD XDFLD

LCHILD establishes relationship between segments of two physically separate databases. LCHILD statement comes under target segment and it should be immediately followed by XDFLD statement.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 56 of 85

Page 57: IMS-DB-DC

IMS Class Room Session

Day 11

Summary:

1. Secondary Index: Order other than segments sequence field.2. Need to have a separate database (Index database). This will only have root only

segment.

PointerOn which index is required

From any source segment, you can select 1 to 5 fields.

3. Identify 1. Source Segment2. Target Segment3. Pointer (You have to build this segment. It is a separate database)

If EMPNAME is a secondary index:

Source Segment: EMPSEGTarget Segment: EMPSEG

If SKILL-ID is a secondary index:

Source Segment: SKLSEGTarget Segment: EMPSEG

4. LCHILD & XDFLD statements are to be coded under target segment.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 57 of 85

Source Target

Page 58: IMS-DB-DC

IMS Class Room Session

5. If duplicates names are present then IMS requires another ESDS dataset to store those pointers.

KSDS ESDS

This requires high overhead. So the solution for this is use to Sub Sequence field. Pick up some value from same segment and put it in KSDS dataset. But still index will be on NAME. But now NAME + field is unique. Programmer will still refer to NAME, but IMS builds the index on NAME + field. So for IMS duplicates are not there.

6. Sometimes there won’t be any field which makes index unique then IMS gives other option of /CK and /SX (these are system related fields)

FIELD NAME=/CK1 START=1 BYTES=6XDFLD ……………………………………….SUBSEQ=/CK1

Refers to concatenated key. Here it is EMPNO so 6 characters. This field is not stored as a part of your segment. This field is stored in Index database.

/SX requires 4 bytes because it works with RBA. This is used with HDAM and HIDAM but not HISAM. Whereas use /CK with all.

FIELD NAME=/SX1 START=1 (here BYTES are not required since it is always 4 bytes)

7. If Indexed database is HISAM then in Index database POINTER must be SYMBOLIC8. If Indexed database is HIDAM then in Index database POINTER may be SYMBOLIC

or SNGLE9. How to make use of this Index?

Normal Way of Access (EMPNO) Using Secondary Index (EMPNAME)PSBPCB TYPE =DB, NAME=EMPDBD,PROCOPT=ASEGMSEGMPSBGEN PSBNAME=…….., LANGUAGE=……….

PSBPCB TYPE =DB, NAME=EMPDBD, PROCOPT=A, PROCSEQ=NAMEDBDSEGMSEGMPSBGEN PSBNAME=…….., LANGUAGE=……….

10. You can code n number of PCB depending on your access requirement11. Use INDICES to access database in normal sequence and faster access to

segments.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 58 of 85

ABC 007 015 029 035 045

Page 59: IMS-DB-DC

IMS Class Room Session

How the Secondary Index Is Maintained When a source segment is inserted, deleted, or replaced in the database, IMS keeps the index current. IMS does this whether or not the application program performing the update uses the secondary index. The way in which IMS maintains the index depends on the operation being performed. Regardless of the operation, IMS always begins index maintenance by building a pointer segment from information in the source segment that is being inserted, deleted, or replaced. (This pointer segment is built but not yet put in the secondary index database.)

When a source segment is inserted, DL/I determines whether the pointer segment needs to be suppressed. If the pointer segment needs to be suppressed, it is not put in the secondary index. If the pointer segment does not need to be suppressed, it is put in the secondary index.

When a source segment is deleted, IMS determines whether the pointer segment is one that was suppressed. If so, IMS does not do any index maintenance. If the segment is one that was suppressed, there should not be a corresponding pointer segment in the index to delete. If the pointer segment is not one that was suppressed, IMS finds the matching pointer segment in the index and deletes it. Unless the segment contains a pointer to the ESDS data set, which can occur with a non-unique secondary index, the logical record containing the deleted pointer segment in a KSDS data set is erased.

When a source segment is replaced, the pointer segment in the index might or might not be affected. The pointer segment in the index might need to be replaced, or it might need to be deleted. After replacement or deletion, a new pointer segment is inserted. On the other hand, the pointer segment might need no changes. IMS determines what needs to be done by comparing the pointer segment it built (the new one) with the matching pointer segment in the secondary index (the old one). If both the new and the old pointer segments need to be suppressed, IMS does

not do anything (no pointer segment exists in the index).

If the new pointer segment needs to be suppressed but the old one does not, then the old pointer segment is deleted from the index.

If the new pointer segment does not need to be suppressed but the old pointer segment is suppressed, then the new pointer segment is inserted into the secondary index.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 59 of 85

Page 60: IMS-DB-DC

IMS Class Room Session

If neither the new or the old segment needs to be suppressed and:

If there is no change to the old pointer segment, IMS does not do anything.

If the nonkey data portion in the new pointer segment is different from the old one, the old pointer segment is replaced. User data in the index pointer segment is preserved when the pointer segment is replaced.

If the key portion in the new pointer segment is different from the old one, the old pointer segment is deleted and the new pointer segment is inserted. User data is not preserved when the index pointer segment is

deleted and a new one inserted.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 60 of 85

Page 61: IMS-DB-DC

IMS Class Room Session

IMS/DC

Transfer Control to other program

To transfer control to another program use: Alternate PCB CHNG Call ISRT Call

PCB TYPE=TP, MODIFY=YES

1. Set alternate PCB to required destination i.e. transaction code of the program.2. Insert a message using alternate PCB.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 61 of 85

TRANSFER SECTION.MOVE ‘MFSTRN02’ TO WS-DEST.

CALL ‘CBLTDLI’ USINGDLI-CHNGALT-PCBWS-DEST.

Alternate PCB is generated by IMS to change the content of this area. We are suppose to use this call. You cannot directly assign value to Alternate-LTERM field of alternate PCB to MFSTRN02Then you issue,

CALL ‘CBLTDLI’ USINGDLI-ISRTALT-PCBSWT-MSG

This message is just for syntax completion

01 WS-DEST PIC X(08).

01 SWT-MSG.05 SWT-LL PIC S9(03) COMP VALUE ‘+5’.05 SWT-ZZ PIC S9(03) COMP VALUE ZEROS.05 FILLER PIC X VALUE HIGH-VALUES.

(Message length cannot be less than 5 characters)

Page 62: IMS-DB-DC

IMS Class Room Session

normally CLEAR key is used to return control back to IMS therefore programmatically you need not return to IMS (In Menu program).

Tips:

1. Use CLEAR key for non-conversational programs2. Conversational program can return control back to IMS programmatically.

Program 1

1. EMPTRN01 (Defined in realims.ims)

12

Program will receive this message now you are suppose to send MENU screen

2. /FOR EMPMENUO

14

So Menu Program will receive 2 types of messages. One will be 12 bytes length and other will be 14 bytes length

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 62 of 85

LL ZZ EMPTRN012 2 8

LL ZZ EMPTRN01 XX2 2 8 2

Page 63: IMS-DB-DC

IMS Class Room Session

Program 2

1. EMPTRN02 Must be rejected2. /FOR EMPADDO

It will receive 5 bytes length message from MENU program

Send Add Screen, user will add data and will press specified AID key to save data.

Program will receive input message of 96 characters.

So this program deals with 2 messages, 5 characters and 96 characters

Program 3

Program 1 will transfer 5 bytes to program 3. Take first five employees into working storage then reply back. If PF7 is pressed:

Which indicates program 3 to program 3, 14 bytes get transferred

How to get last employee number of previous screen to display next five records?There are two possibilities:

1.

2. Store employee-number some where before reply back. Then afterwards co-relate with terminal user and use it.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 63 of 85

LL ZZ EMPTRN02 XX NO NAME ADDR2 2 8 2 6 30 40

LL ZZ EMPTRN03 XX

2 2 8 2

LL ZZ EMPTRN03 08 EMPNO

2 2 8 2 6

Page 64: IMS-DB-DC

IMS Class Room Session

So,

1. Create one database (HDAM) which will be root only

2. Create one field on screen, keep it as hidden field, store start and stop values to it.

Note : Creation of list on screen DO 5 DFLD : : END

3. Store this in memory (Like commarea in CICS)

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 64 of 85

LTERM EMPNO

LL ZZ EMPTRN03 08 0001 0005……………………

Page 65: IMS-DB-DC

IMS Class Room Session

Day 12

Cursor positioning and Dynamic Attribute Modification

You can change the attributes of any field before sending it to user. This can be done dynamically in the program as per the requirement. Otherwise the original attributes will be in effect.

The attribute setting and cursor positioning is done using 2 bytes attribute field.

Dynamic Cursor Positioning:-

0 1 2 3 4 5 6 7

Bits 0 and 1 are use for cursor positioning:

00 : Positioning not required11 : Position cursor on this field

Bits 2 to 7 are always zeros. 000000000 : x ‘00’ 110000000 : x ‘C0’ So if validation of field fails

Move ‘C0’ to attribute byte of the field to position cursor on that field.

Dynamic Attribute Setting:-

0 1 2 3 4 5 6 7

Bit 0 : Always 1 Bit 1 : 0 or 1 (use always 1) Bit 2 : Protection Attribute. 0-Unprotected, 1-Protected Bit 3 : Shift Attribute. 0-Alphanumeric Shift, 1-Numeric Shift Bit 4 and 5 : Intensity Attribute. 00-Normal, 01-No Display, 10-Bright, 11-Bright Bit 6 : Light Pen Detection. Should always be zeros Bit 7 : Modified data tag. 0-MDF OFF, 1-MDT ON

For example: To position the cursor on field and making it bright

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 71 1 0 0 0 0 0 0 1 1 0 0 1 1 0 1

X ‘C 0’ X ‘C D’Output message format:

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 65 of 85

01 OUTPUT-MSG. 05 LL ……… 05 ZZ ………. 05 ATTR1A PIC X(01). 05 ATTR1B PIC X(01). 05 FIELD1 PIC X(-). 05 ATTR2A PIC X(01). 05 ATTR2B PIC X(01). 05 FIELD2 PIC X(-). :

Page 66: IMS-DB-DC

IMS Class Room Session

MOVE X’C0’ TO ATTR1A.MOVE X’CD’ TO ATTR1B.

Alternate PCB

There are two types of Alternate PCB

1. Modifiable

Alternate PCBs are also used to send messages to other terminals (for business needs)

For such case use this type. And issue1. CALL CHNG LTERM012. CALL ISRT3. Use PURG call. This will force the message to go to that terminal

2. Fixed

Here there is no need of CHNG call because destination is already specified.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 66 of 85

PCB TYPE=TP, MODIFY=YES

PCB TYPE=TP, LTERM=EMPTRN02PCB TYPE=TP, LTERM=EMPTRN03

Page 67: IMS-DB-DC

IMS Class Room Session

Some Important Points:

1. DL/I call gets translated to VSAM dataset internally2. HDAM requires 1 ESDS file. (IMS0.PROD.EMPDB)3. Program is accessing EMPDBD

This call goes to control region. Database is known by Db-PCB. In this DBD mention DATASET = DDNAME In a startup JCL you specify the dd statement for DL/I database. This is the way of

IMS to inform control region about datasets. Whatever is running under IMS/DC, does not require any DD statement that is

how all online programs, which are MPP, accesses databases. Also for BMP programs DD names are not required.

4. Instead of allocating all the datasets in advance which increases the overhead of system, another way is:

DFSMDA macro statements: Dynamic allocation on demand

For 300 databases , you’ll get 300 DFSMDA members. When they are translated they are kept into one library. This library must be concatenated to your RESLIB.

Initially database is not allocated. When program starts execution and it makes call to that database, IMS

looks it into this library and allocates space. For each database there will be a separate PDS member. Which will have

DD and dataset name.

5. Why we run programs in BMP?We cannot give exclusive control to database. We want other programs to

share the database therefore in production most of the programs are BMP programs. If they are DL/I they must run during nighttime, when online system is off. In DL/I , data sharing in not available. You r job is directly running under MVS, gains exclusive control on databases.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 67 of 85

CALL ‘CBLTDLI’ USING DLI-REPL DB-PCB SEG-AREA SSA

DFSMDA

DD……..EMPDB…..DSN=…………….:::

Page 68: IMS-DB-DC

IMS Class Room Session

6. Concurrency: Many users using databases simultaneously

-ACID property of transaction

7. MPP online programs:

Each message is a transaction. When program fetches next message, previous transaction is completed and resources are released.

8. BMP Batch programs:

IMS assumes Start of the program and End of the program as one transaction. If you are updating payroll at end of month, which is a BMP transaction. So until this program finishes, all the involved segments will not be available which is not a welcome situation therefore some mechanism, which should release the resources in between (otherwise data won’t be available to other program, might get 777error) since batch program is holding those resources. To resolve this, some position in between is required. There are 2 types of breaks:

a. Break it by timeb. Break it by number of input records processed

The way to break is use of Checkpoint call. IMS provides this facility. Whatever is locked up to that checkpoint call is released for other programs to use.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 68 of 85

In a shared system it is necessary to release a lock as soon as possible Online transaction should not take long time

Page 69: IMS-DB-DC

IMS Class Room Session

Day 13

Frequent Checkpoints

1. Concurrent Usage Of Data

How to find out whether any other concurrent user is using that resource or a segment?

Make use of Log (System Log) Analyze PSB, how many programs are using the database you are going to

update. If you found that P1, P7, P56, P35 programs also uses the databases you are using, next find out

The usage or frequency of the program going to run. If they are running frequently then you have to give frequent checkpoints. If the frequency is low, you may not give checkpoints after every transaction

2. Determine frequency (Not for AMEX)

3. ARC: Application Restart Control. It’s a utility to dynamically change the checkpoints.

4. Checkpoint after every transaction.

Another reason for checkpoint:

1. Restart: If program abends, you should start from the transaction, which was not committed.

2. Recovery: If disk drive fails, then you have a database backup, take log dataset, from log get the updates and update the backed up database and bring it to current position where the failure occurred. Therefore take image copy of every database daily, hourly, weekly etc. So that you can take a latest copy of it and then apply all the changes from log for that database to the image copy. This is forward recovery. Now you have to restart the program from the point where the ABEND occurred in the last execution.

How program will decide from which point to start?(for example in the previous execution 399000 records were processed so now it should start from 400000th record)

Every checkpoint will have checkpoint identifier. How to get unique Checkpoint-id?

First time run a normal run without ABEND. You will get JES message for last transaction, which will have some message number.

From where you will get checkpoint id? (JOBLOG) JES

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 69 of 85

Page 70: IMS-DB-DC

IMS Class Room Session

Store other details when you are taking checkpoint You need to store variables, which were changed in the last execution during last

checkpoint. After restart, you need to supply this detail along with checkpoint-id. Also store key information along with checkpoint-id. For files you should have

number of records read during last execution. I.e. count of number of records processed, So with this count you can restart from next record in a file (Input file)

1. When you are running program as a BMP, if ABEND occurs then IMS backs out the changes you have made up to the previous checkpoint.

2. When you are running program as a DL/I, this does not happens automatically, you have to backed out using some utility(Batch Backout Utility). You have to give the checkpoint-id to which you want to backed out for restart. (options in JCL)

LOG

IMS/DC uses OLDS (Online Log dataset). It contains system related information and database (IMS) related information. It is implemented in 3 stages:1. Memory Buffer2. Disk Dataset (there are 3 identical datasets. When this gets full, it is moved on to

Tape)3. Tape

Memory buffer and disk datasets are WADS (Write Ahead Datasets, smaller size, faster devices)

DBRC software reads OLDS from Tape

Again Tape is divided into 2 types

1. System Log dataset (SLDS)2. Database recovery Log (RLDS)

In addition to OLDS, IMS also maintains RDS(Restart Dataset). This is nothing but IMS checkpoints to restart IMS in case of IMS failure. These are not our program checkpoints.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 70 of 85

777 Abend-deadlock abend. From system log take print of x’67’ report to know which other concurrent programs are using database the one which your program is using

Checkpoint frequency needs to be increased

Page 71: IMS-DB-DC

IMS Class Room Session

Checkpoint Identifier

It is of 8 characters in IMS.

First 4 characters will be program-id.

Last 4 characters will be a number

But in this case if 9999 limit is reached it resets to zero. So here now 2 records can have duplicate checkpoint. Then which one will IMS use the first one or last one?

So for this also include time-stamp information into checkpoint-id. Format for which is:

IIDDDHHMMDSSSTII: Region IdDDDHHMMDSSST: Actual time in days, hours, minutes, seconds, and 10th of second.

Or IMS checks log backward, so always it will take the latest one.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 71 of 85

First 4 characters will be program id: F350 or F355

Last 4 characters will be number up to 9999

IMS takes care of IMS databases only. IMS Log will not support anything, which is not IMS supported.

Page 72: IMS-DB-DC

IMS Class Room Session

GSAM Files

IMS cannot handle other sequential file for recovery. That is IMS does not support other files checkpoint. COBOL support for checkpoint is RERUN clause in SELECT statement. MVS provides checkpoint facility for all files. Therefore sequential file have to use MVS checkpoints. And IMS files will use IMS checkpoints. Both need to be identified by one single checkpoint mechanism. So how to resolve this?Some how we need to make sequential file as IMS database. So here sequential file is wrapped as database. Now IMS will understand this sequential file as a IMS database. This type of database is known as GSAM (Generalized Sequential Access Method) database. It is a wrapper for your input or output sequential file

DBD definition

PSB definition

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 72 of 85

If you take directly sequential file, as it is then you will not able to use IMS checkpoints therefore convert this file to GSAM database. Now IMS will work on it. This file will be treated as an IMS database

DBD NAME=TRANDBD, ACCESS=(GSAM,BSAM)DATASET DD1=TRANIN, RECFM=F, RECORD=70DBDGENFINISHEND

PCB TYPE=DB,NAME=EMPDBDPCB TYPE=GSAM,NAME=TRANDBDPSBGENEND

GSAM database cannot be used by MPP programs GSAM database can only be processed by BMP and DL/I programs

Page 73: IMS-DB-DC

IMS Class Room Session

Day 14

Four possible values given to GSAM:

Access Meaning RemarkL Load Write to databaseG Get Read databaseLS Load Sequential.

For every write disk IO won’t take place. Records get stored into buffer. When buffer gets full, records are written to dataset

Write to database. AMEX standard. Used to improve performance by reducing IO time.

GS Get Sequential.While reading data, group of records gets written into buffer. Whenever user asks for particular record, it is given from buffer.

Read database. AMEX standard. Used to improve performance by reducing IO time.

Reading GSAM in Random Mode

Using Record Search Argument, you can read the GSAM file randomly.

Record Search Argument (RSA):

Record Search Argument is made up of two fields:

Declare this area in working storage of the program. When this area is specified with GN call. Address associated with record gets store in this area(RSA). Like this you can get all the records address. Create an array for storing all RSA values. Then in the same program you can read record randomly using RSA.

Simple GN call: (Here you won’t get RSA information)

Variation On GN call:

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 73 of 85

01 GSAM-RSA. 05 WORD1 PIC S9(05) COMP. 05 WORD2 PIC S9(05) COMP.

CALL ‘CBLTDLI’ USING DLI-GN GSAM-PCB IO-AREA

CALL ‘CBLTDLI’ USING DLI-GN GSAM-PCB IO-AREA GSAM-RSA

Page 74: IMS-DB-DC

IMS Class Room Session

Here you will get the value associated with record. This will be a identifier for that record.You can create an array of all RSA values

In the same program now you can read GSAM file randomly by issuing GU call:

You can use GSAM-RSA with ISRT call. This is optional. When record gets written, GSAM-RSA will have some value, Which you can use to retrieve the same record.

Two special calls used with GSAM

GSAM databases are opened IMS or you can open explicitly by issuing following calls:

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 74 of 85

01 RSA-TABLE. 05 GSAM-RSA OCCURS 200 TIMES. : :

CALL ‘CBLTDLI’ USING DLI-GU GSAM-PCB IO-AREA GSAM-RSA

CALL ‘CBLTDLI’ USING DLI-OPEN GSAM-PCB

CALL ‘CBLTDLI’ USING DLI-CLSE GSAM-PCB

Page 75: IMS-DB-DC

IMS Class Room Session

Scratch Pad Area (SPA):

Hidden field, which is used to store page number and Start, Stop value may not be sufficient in case if the number of pages increases. So the solution is create HDAM database, which will be root-only to store page number, start-key and stop-key value. Before sending employee listing to user store all these details in this database. All user of this program will use the same HDAM database therefore make LTERM-ID as a part of its record. So now HDAM database record segment will be:

When PF3 key is pressed from your terminal, i.e. go back to MENU, delete the record associated with your LTERM-ID.

When user and program are interacting with each other, 79 character hidden field or HDAM database can be used.

Another way is Scratch Pad Area (SPA) size: 32760 bytes:

This area is used when programs interact with each other and they need to pass data to each other.

Scratch Pad Area: IMS facility for session management used between programs. Also in single program. Definition of SPA should be such that it should take care of all communication iterations.

Program Called By CallsPgm1 Transaction Id Pgm2, Pgm3

Transaction Id + detailsPgm2 Pgm1 Pgm1Pgm3 Pgm1 Pgm1

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 75 of 85

LTERM PAGE START-KEY END-KEY

Pgm1

Pgm2

Pgm3

Page 76: IMS-DB-DC

IMS Class Room Session

Program2 and Program3 should not be allowed to start by typing transaction-id of the program. To keep track of this you should store called programs transaction id. This is a general requirement. In addition for program 3 you need to save page details and then at top you need to add IMS related fields. So SPA declaration will look like this:

All the 3 programs are going to use this 100 bytes SPA area.

Reading SPA:

First GU call will retrieve the SPA followed by GN call, which retrieves the message.

When nothing is send, you will get ‘QC’ status code. So check for this status code. After this issue following to retrieve messages. This will be in loop until end-of-message which is status code ‘QD’

Writing SPA:

Transferring control:

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 76 of 85

01 SPA-AREA. 05 SPA-LL PIC S9(04) COMP. 05 SPA-ZZ1 PIC S9(04) COMP. 05 SPA-ZZ2 PIC S9(04) COMP. 05 SPA-TRANSACTION-CODE PIC X(08). 05 WORK-AREA.

10 CALLING-PGM PIC X(08). 05 PGM3-SAVE.

10 SCROLL-INFO OCCURS 5 TIMES. 15 SCROLL-PAGE PIC 9(01). 15 SCROLL-START PIC X(06). 15 SCROLL-END PIC X(06).

05 FILLER PIC X(13).

CALL ‘CBLTDLI’ DLI-GU IO-PCB SPA-AREA

CALL ‘CBLTDLI’ DLI-GN IO-PCB MSG-AREA

CALL ‘CBLTDLI’ USING DLI-ISRT IO-PCBSPA-AREA.

CALL ‘CBLTDLI’ USING DLI-ISRTIO-PCBOUTPUT-MESG.

Page 77: IMS-DB-DC

IMS Class Room Session

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 77 of 85

CALL ‘CBLTDLI’ USING DLI-CHNG ALT-PCB WS-DEST

CALL ‘CBLIDLI’ USING DLI-ISRTALT-PCBSPA-AREA

CALL ‘CBLTDLI’ USING DLI-ISRTALT-PCB MandatorySWT-MSG

Page 78: IMS-DB-DC

IMS Class Room Session

How SPA Works?

Menu Employee Addition Employee Listing

Pgm:Pgm001 Pgm:Pgm002 Pgm:Pgm003Trans-id:EMPRN01 Trans-id:EMPTRN02 Trans-id:EMPTRN03

User must start this system with MENU 1. By typing transaction id EMPTRN012. /FOR MENUO

If user starts with /FOR ADDO, then how to stop user to start pgm002 directly?

Solution 1: (By using switch message)

Check for message length. If it is 5, it’s a valid start. But how to check for calling program name so modified swt-msg will be:

Transaction id of the calling program

Create one blank field on ADD screen. When pgm001 starts pgm002 store calling program’s transaction code into this dark field. So now pgm002 can check for transaction code of pgm001 in this dark field to check for a valid start. If pgm002 is start by typing /FOR ADDO then this field will be blank. Like this you can check for the correct start of the program

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 78 of 85

MENU

PF1: ADDPF2: LISTCLEAR:EXIT

ADD EMP

NO.:NAME:ADDR:PF3 TO MENU……………

EMP LISTNO NAME ADDR----- --------- ------------ --------- --------PF7-UP PF8-DOWNPF3-MENU

LL ZZ TRANSACTION ID PFKEY

Page 79: IMS-DB-DC

IMS Class Room Session

Solution 2: (By using VSAM dataset)

VSAM ksds dataset will have following fields:

1. Unique LTERM2. Calling program’s transaction id

LLZZEMPTRN01 (12 bytes message)

From IO-PCB get the LTERM and look into VSAM dataset. First time you won’t find it so write it into the dataset. Display blank MENU screen. Now control goes to MENU program. User enters 1st option so control goes to pgm002. Before transferring control to pgm002 change the calling program’s transaction code to EMPTRN01 in VSAM dataset. So now pgm002 can check for this transaction code to see whether it’s a valid start or not. Same for the LIST program.

Menu Program:

Solution 3: All these things can be provided by Scratch Pad Area, facility provided by IMS.

Our requirement of storage

For MNEU and ADD program: 8 bytesFor LIST program: 8 bytes + 100 bytesIn addition 14 bytes will be for:

SPA-LL SPA-ZZ1 SPA- ZZ2 SPA-TRAN2 2 2 8

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 79 of 85

EMPTRN01 MENU:::

GET-MSSAGE.GET-FROM-VSAM.GET-MSG.

REPLY-BACK.REPL-ISRT-VSAM’ISRT-MSG

TRANSFERREPL-INTO-VSAMISRT-ALT-DEST

01 SPA-AREA. 05 SPA-LL PIC S9(04) COMP. 05 SPA-ZZ1 PIC S9(04) COMP. For IMS. 05 SPA-ZZ2 PIC S9(04) COMP. You should not 05 SPA-TRANSACTION-CODE PIC X(08). Change this area. 05 WORK-AREA.

10 CALLING-PGM PIC X(08). 05 PGM3-SAVE.

10 SCROLL-INFO OCCURS 5 TIMES. 15 SCROLL-PAGE PIC 9(01). 15 SCROLL-START PIC X(06). 15 SCROLL-END PIC X(06).

05 FILLER PIC X(13).

Page 80: IMS-DB-DC

IMS Class Room Session

The content of this SPA will be all binary zeros. IMS looks at your message first since it is for the first time IMS creates this area, puts transaction-id over here. Calling program will be blank. Which is acceptable condition since it is a starting program. Make it as a EMPTRN01. Suppose it is not a binary zeros that indicates pgm002 or pgm003 must have called the MENU program. So all these are valid values for pgm001 to start

Program Values to be checked RemarkPgm001 Binary zeros First start

EMPTRN01 Calling itselfEMPTRN02 Called by pgm002EMPTRN03 Called by pgm003

Pgm002 Binary zeros Raise an errorEMPTRN01 Called by pgm001EMPTRN02 Calling itself

Pgm003 Binary Zeros Raise an errorEMPTRN01 Called by pgm001EMPTRN03 Calling itself

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 80 of 85

Each terminal will have a SPA.

EMPTRN01

By pressing CLEAR key SPA associated with that terminal will be deleted.

Page 81: IMS-DB-DC

IMS Class Room Session

When SPA is created first time by IMS, IMS pulls out the transaction code from the message and puts it into SPA transaction code.

That is if the message is:

SPA will be

Then message will shorten to:

2

You have to take care of this situation. (Message length 6). So for this read SPA, take transaction-code put it into message. So now message is back to 12 characters length.

There is a problem if transaction code is less than 8 characters. The thing is IMS parsing for transaction code stops only after 8 characters or when blank is encountered. That’s the reason of taking care for keeping transaction-id 8 characters long. If you keep transaction code 8 characters long only check for 6 characters length need to be done after writing SPA area.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 81 of 85

LL ZZ TRANS-CODE PFKEY2 2 8 2

LL ZZ1 ZZ2 TRANS-CODE2 2 2 8……………………………….

LL ZZ PFKEY2 2 2

Page 82: IMS-DB-DC

IMS Class Room Session

Some examples of transaction code less than 8 characters:

Input Message Message After writing transaction code to SPA

Remark

Transactioncode pfkey2 2 8 2

2 2 2

You have to take care of this 6 character length message

2 2 4 2 2 2 3 2

You have to take care of this 9 character length message

2 2 6 2 2 2 1 2

You have to take care of this 7 character length message

When moving back to IMS from any screen that is pressing PF 3 to exit, write following steps in the associated section:

1. insert spaces to transaction code of SPA2. insert that spa to IMS, using IO PCB

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 82 of 85

LL ZZ E M P TRN 0 1 0 1 LL ZZ 0 1

LL ZZ E M P T 0 1

LL ZZ 0 1

LL ZZ E M P TRN 0 1 LL ZZ 0 1

Programs with SPA are conversational programs Programs without SPA are non conversational programs

Page 83: IMS-DB-DC

IMS Class Room Session

Day 15

Check point

Syntax:

When this call gets executed

1. IMS creates records with checkpoint identification.2. It will also contain repositioning information3. All this will be attached with checkpoint identification.4. All this information will go into log5. All the updates to database since the last checkpoint will be made

permanent

Restart:

Restart will do the repositioning of the database, it will keep the memory content identical as of previous run fail. So if checkpoint is given when ckptr=17, needs to restart from FA350017.

Program is required to work in two modes:

1. Normal Run2. Restart Run

Therefore needs to communicate with program to inform whether it’s a normal run or restart run

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 83 of 85

CALL ‘CBLTDLI’ USING DLI-CHKP IO-PCB IO-AREA-LEN CKPT-ID-AREA AREA1-LEN AREA1 : : AREA7-LEN AREA7

Page 84: IMS-DB-DC

IMS Class Room Session

Syntax:

It is same as checkpoint call except here CKPT-ID-AREA that is XRST-AREA will be 12 bytes

01 XRST-AREA.05 CKPT-ID PIC X(08) VALUE SPACES.05 FILLER PIC X(04) VALUE SPACES.

Initialization with spaces is must

XRST call is written as a first call in your program. Program should determine the mode of run by checking the CKPT-ID field of XRST-AREA. If it is blank. It indicates a Normal run. If it contains the checkpoint-id then it is a restart run.

Therefore it must to put VALUE SPACES at the time of declaration.

XRST call will read log backwards, moves all area back to program work area. Also repositions the database if it is a restart run.

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 84 of 85

CALL ‘CBLTDLI’ DLI-XRSTIO-PCBIO-AREA-LENXRST-AREAAREA1-LENAREA1::AREA7-LENAREA7

Page 85: IMS-DB-DC

IMS Class Room Session

Programming tips for program using checkpoint and restart logic.

Call XRST

Check for restart-id

If spaces Normal run

ElseMove restart-area to working-storage-area

End-if

Process

If want to take checkpoint after 500 updates:

Process Some update activities Increment update counter If update counter = 500

CALL ‘CBLTDLI’ USING DLI-CHKP:

check for blank status code and SK status code SK status code is raised when checkpoint is taken before setting given in

AES. That is if in AES the entry is given as 700, then AES will not honored this checkpoint. It will automatically take the checkpoint after 700 updates. Now this can be overridden thru JCL by giving PACECHP = no parameter.

TSO BMCARC or BMCAES will allow you to delete all the previous checkpoints

To terminate program after 5 checkpoints mention following in JCL:

//ARCSYSIN DD * PACECHKP=N TRMAFTERCKP=5

IEFRDER: System Log. Current updates are maintained over here. This is used for Normal run

When Checkpoint is given and program abends, IEFRDER is moved into IMSLOGR. IMS uses IMSLOGR to restart. So for restart IEFRDER becomes IMSLOGR and

IEFRDER will be used for the current run. For normal run IMSLOGR is not required. Only need to specify IEFRDER This is only for DL/I jobs. For BMP IEFRDER is not required. It is done by control

region (IMS startup and shutdown)

Developed By:Shilpa Keluskar & Suvarnalata Naik Page 85 of 85