IMS Basics
IMS Basics
1. COMPONENTS.......................................................................................................................................................3
   1.1 IMS/VS.................................................................................................................................................................3
   1.2 IMS/360................................................................................................................................................................3
   1.3 DL/I - DOS/VS.....................................................................................................................................................3
   1.4 FIVE COMPONENTS OF IMS ENVIRONMENT...................................................................................................................3
2. DL/I TERMINOLOGY............................................................................................................................................6
   2.1 HIERARCHICAL STRUCTURE FOR HOSPITAL DATABASE.......................................................................7
3. DATABASE HIERARCHY CHART......................................................................................................................8
   3.1 SEGMENT (TYPE)..............................................................................................................................................8
   3.2 SEGMENT (OCCURRENCES)...........................................................................................................................8
   3.3 SEGMENT (RELATIONSHIPS)..........................................................................................................................9
   3.4 SEGMENT (TWINS) - MULTIPLE OCCURRENCE......................................................................................................9
   3.5 HIERARCHICAL PATHS....................................................................................................................................9
   3.6 DATABASE (IMS)...............................................................................................................................................9
   3.7 DATABASE RECORD.......................................................................................................................................10
4. DESIGNING AND DESCRIBING THE DATABASE TO IMS / DL - I............................................................11
   4.1 KEY OR SEQUENCED FIELDS.......................................................................................................................11
   4.2 ADDITIONAL SEARCH FIELDS.....................................................................................................................11
   4.3 DATABASE DESCRIPTION (DBD).................................................................................................................12
   4.4 HOSPITAL DATABASE DBDGEN MACROS..................................................................................................................13
5. APPLICATION / LOGICAL DATA-STRUCTURE (PSB).................................................................................15
   5.1 HOSPITAL DATABASE PSBGEN MACROS...................................................................................................................16
6. DL / I PROGRAMMING CONSIDERATIONS..................................................................................................18
   6.1 WORKING STORAGE SECTION....................................................................................................................18
   6.2 LINKAGE SECTION.........................................................................................................................................19
   6.3 PROCEDURE DIVISION..................................................................................................................................19
   6.4 DL/I CALLS.......................................................................................................................................................20
   6.5 SEGMENT SEARCH ARGUMENT: - ..............................................................................................................................22
   6.6 SSA STRUCTURE: ...........................................................................................................................................23
   6.7 SSA TYPES: ......................................................................................................................................................24
   6.8 CALL TYPES.....................................................................................................................................................25
   6.9 DATABASE DL/I CALLS..................................................................................................................................26
   6.10 RELATIONAL OPERATORS..........................................................................................................................27
   6.11 HOSPITAL DATABASE SEGMENT OCCURRENCE CHART....................................................................28
   6.12 RANDOM RETRIEVAL USING GU CALL...................................................................................................29
   6.13 SEQUENTIAL RETRIEVAL USING GN CALL............................................................................................29
   6.14 GN CALLS WITHOUT SSA'S (UNQUALIFIED GN CALLS)..............................................................................................31
   6.15 GN CALL WITH UNQUALIFIED SSA'S (QUALIFIED GN CALL).....................................................................................31
   6.16 GN CALL WITH QUALIFIED SSA'S (QUALIFIED GN CALL)........................................................................................31
   6.17 GN CALLS - STATUS CODES...........................................................................................................................32
   6.18 SEQUENTIAL RETRIEVAL USING GNP CALL..........................................................................................33
   6.19 GNP CALLS WITHOUT SSA'S (UNQUALIFIED GNP CALL)..........................................................................................33
   6.20 GNP CALL WITH UNQUALIFIED SSA'S (QUALIFIED GNP CALL).................................................................................34
   6.21 GNP CALL WITH QUALIFIED SSA'S (QUALIFIED GNP CALL).....................................................................................35
   6.22 GNP CALLS - STATUS CODE...........................................................................................................................35
7. UPDATING AND DELETING SEGMENTS.......................................................................................................36
   7.1 GET HOLD CALLS...........................................................................................................................................36
   7.2 DELETE AND REPLACE RULES....................................................................................................................36
                                                                             -1-
IMS TRAINING MATERIAL
                                                                          -2-
IMS TRAINING MATERIAL
                           1.             Components
      1.1 IMS/VS
      -    This is the latest version
      -    Consists of a DL/I component that interface with the Database
      -    Consists of Data communication component that interface with the users at remote
           terminals
      -    Runs under operating system MVS/OS/VS1/OS/VS2
      1.2 IMS/360
      -    Runs under operating system OS/VS1/OS/VS2
      -    Consists of a DL/I component that interface with the Database
      -    Consists of a Data Communication component that interface with the users at remote
           terminals
                                           -3-
IMS TRAINING MATERIAL
           -    There are two main DL/I control blocks, one describing the database structure, the
                other identifying how the database may be accessed by the program
           -    They are Database Descriptor (DBD), and Program Communication Block (PCB)
           -    The Database Administration Group normally maintains these control blocks.
           -    DBD describes the physical structure of a database as well as the way in which it is
                stored on the DASD and the way it is accessed
           -    PSB describes the Logical Structure of a Database as a particular application program
                views it. It identifies which pieces of data a program is allowed to access and the
                kinds of functions (operations) it can perform on each collection of data.
D) Application Program
           E)      Data Communication
           -    Is a set of program modules that allow the program to communicate with remote
                terminals
           -    Programs communicate with terminals through a Standard Interface Language using
                CALL statements with a parameter list.
                    Operating
                     System
                                                            IMS Database
DL/I
Figure 1            Application
                     Program
                                               -4-
IMS TRAINING MATERIAL
                        -5-
                 2. DL/I Terminology
Assume, the general information we store in the HOSPITAL Database is:
I] HOSPITAL information
      A] WARDS & ROOMS information in each hospital
            1) PATIENTS information in each WARD
                a) SYMPTOMS
                b) TREATMENTS
                c) DOCTORS
      B] SPECIAL FACILITIES information in each hospital
1      HOSPITAL
       05    HOSPNAME               PIC X(20)                  Unique Key
       05    Hosp-Address           PIC X(30)
       05    Hosp-Phone             PIC X(10)
1      WARD
       05    WARDNO                 PIC X(2)                   Unique Key
       05    Total-Rooms            PIC X(3)
       05    Total-Beds             PIC X(3)
       05    BEDAVAIL               PIC X(3)                   Search
       05    WARDTYPE               PIC X(20)                  Search
1      PATIENT
       05    PATNAME                PIC X(20)                  Search
       05    Patient-Address        PIC X(30)
       05    Patient-Phone          PIC X(10)
       05    BEDIDENT               PIC X(4)                   Unique Key
       05    DATEADMT               PIC X(6)                   Search
1      SYMPTOM
       05    DIAGNOSE               PIC X(20)                  Search
       05    SYMPDATE               PIC X(6)                   Non-Unique Key
       05    Treat-Description      PIC X(20)
       05    Symp-Doctor            PIC X(20)
       05    Symp-Doc-Phone         PIC X(10)
1      TREATMNT
       05    TRTYPE                 PIC X(20)                  Search
       05    TRDATE                 PIC X(6)                   Non-Unique Key
       05    Medicine-Type          PIC X(20)
       05    Diet-Comment                 PIC X(30)
       05    Surgery-Flag           PIC X
       05    Surgery-Date           PIC X(6)
       05    Surgery-Comment        PIC X(30)
       1         DOCTOR
                 05    DOCTNAME               PIC X(20)                    Search
                 05    Doct-Address           PIC X(30)
                 05    Doct-Phone             PIC X(10)
                 05    SPECIALT               PIC X(20)                    Search
       1         FACILITY
                 05    FACTYPE                PIC X(20)                    Search
                 05    Tot-Facility           PIC X(3)
                 05    FACAVAIL               PIC X(3)                     Search
                                               PATIENT
LEVEL 3
− Note
–IMS maintains an Inverted Tree Structure starting with the Root Segment by ensuring that no
segment has more than one parent
–Each box represents a segment name of up to 8 characters at each level called as a Segment
Type
–The above diagram of Hospital Database is called as an Database Hierarchy Chart
–The Hierarchy can go up to fifteen levels down
–The Hierarchy can represent up to 255 segment types
      3. DATABASE HIERARCHY CHART
        3.1 SEGMENT (TYPE)
        -   It is the smallest unit of information DL/I handles
        -   Within each segment are one or more data fields
        -   Each 01 level data name defines one of the segments in the Hospital Database
        -   Each 03 level data name defines one of the fields within a segment
        -   If an application program requires information only about a segment, it does not even
            have to know that the other segments exists, or what their relationships are within the
            database
        -   Also known as a Segment Type
        -   Can have up to 255 segment types in a Database record, and up to 15 segment types
            in any one hierarchical path.
                                                          B     C
                                                          A
                                               HOSPITAL
WARD FACILITY
                                                3
                                           2
                                       1
                             PATIENT
Figure 3 :- Can   store as many segment occurrences as the storage permits for any segment type.
3.3 SEGMENT (RELATIONSHIPS)
-   The terms Parent and child are used to describe the relationships between segment
    types within a database
-   A segment that has one or more segments directly below it in the hierarchy is called a
    PARENT segment
-   A segment that has a segment directly above it in the hierarchy is called a CHILD
    segment
-   Parent and Child segments are relative terms which depends upon which portion of
    the database hierarchy is under focus of discussion
-   A child segment is also called as a DEPENDENT segment
-   The concept of Dependent segments extends more than one level in the hierarchy
-   If a parent occurrence is deleted, so are all its children
    PRINT              NOGEN
    DBD           NAME=HOSPDBD, ACCESS=HISAM
    DATASET       DD1=HOPSET, OVFLW=HOSPFLW, DEVICE=3330
    SEGM          NAME=HOSPITAL, PARENT=0, BYTES=60
    FIELD         NAME=(HOSPNAME,SEQ,U), BYTES=20, START=1, TYPE=C
    SEGM          NAME=WARD, PARENT=HOSPITAL, BYTES=31
    FIELD         NAME=(WARDNO,SEQ,U), BYTES=2, START=1, TYPE=C
    FIELD         NAME=BEDAVAIL, BYTES=3, START=9, TYPE=C
    FIELD         NAME=WARDTYPE, BYTES=20, START=12, TYPE=C
    SEGM          NAME=PATIENT, PARENT=WARD, BYTES=70
    FIELD         NAME=(BEDIDENT,SEQ,U), BYTES=4, START=61, TYPE=C
    FIELD         NAME=PATNAME, BYTES=20, START=1, TYPE=C
    FIELD         NAME=DATEADMT, BYTES=6, START=65, TYPE=C
    SEGM          NAME=SYMPTOM, PARENT=PATIENT, BYTES=76
    FIELD         NAME=(SYMPDATE,SEQ), BYTES=6, START=21, TYPE=C
    FIELD         NAME=DIAGNOSE, BYTES=20, START=1, TYPE=C
    SEGM          NAME=TREATMNT, PARENT=PATIENT, BYTES=113
    FIELD         NAME=(TRDATE,SEQ), BYTES=6, START=21, TYPE=C
    FIELD         NAME=TRTYPE, BYTES=20, START=1, TYPE=C
    SEGM          NAME=DOCTOR, PARENT=PATIENT, BYTES=80
    FIELD         NAME=DOCTNAME, BYTES=20, START=1, TYPE=C
    FIELD         NAME=SPECIALT, BYTES=20, START=61, TYPE=C
    SEGM          NAME=FACILITY, PARENT=HOSPITAL, BYTES=26
    FIELD         NAME=FACTYPE, BYTES=20, START=1, TYPE=C
    FIELD         NAME=FACAVAIL, BYTES=3, START=24, TYPE=C
    DBDGEN
    FINISH
  END
DATASET          - Specifies the names of files used to store the data. HISAM
                 database requires two files and their names must be included in the
                 program execution JCL accessing the database. Device specifies
                 the device type in which the allocated files will store the segment
                 data
SEGM             - Each SEGM statement names and describes one segment type
                 that will make up the database. Name operand names the segment
                 type. Parent operand names the parent of each segment type
                 thereby defining the Hierarchical Structure of a database. A root
                 segment is identified by the absence of a Parent operand or
                 Parent=0. The SEGM statements are coded in the hierarchical
                 sequence of the segment types, that is, from TOP to BOTTOM and
                 from LEFT to RIGHT. The Bytes operand specifies the segment
                 length in terms of bytes.
FIELD            - Each field statement names and describes the key and search
                 fields for a segment. NAME parameter contains from one to three
                 positional sub-parameters. The first sub-parameter names the key
                 or search field. If it is the only sub-parameter coded, the field will
                 be a search field. If SEQ is coded as the second sub-parameter, the
                 field will be a key field, and the occurrences will be sequenced in
                 Ascending order. This is optional. If specified, only one key field is
                 allowed per SEGM statement. If U is coded as the third sub-
                 parameter, the field is a UNIQUE sequence field unless M is
                 specified for Multiple value in the field. If neither 'U' nor 'M' is
                 specified when SEQ is coded, the sequence field is taken to be
                 unique. A unique sequence field is required for the root segment in
                 HISAM and HIDAM methods. The START operand tells the
                 starting byte position of the key or search field relative to the
                 beginning of the segment. The BYTES operand tells the field
                           length in bytes. TYPE operand tells the data type of field,
                           accordingly C specifies a character field of alphanumeric type, P
                           specifies a packed Decimal numeric type. C is the default data
                           type. FIELD statement for the sequence field, if there is one, must
                           be the first such statement for the segment.
      DBDGEN               - This statement ends the SEGM and FIELD definitions for the
                           DBD
− Note
That the names of the Segments key & search fields that match in the COBOL Structure with
that of the names used in the DBD is not an IMS requirement.
5. APPLICATION / LOGICAL DATA-
       STRUCTURE (PSB)
-   Logical Data Structure is a term used to refer to a group of segments that an
    application program may access. To the application program, the logical data
    structure is the database
-   The DBA defines the logical data structure by creating a Control Block called a
    Program Specification Block or PSB.
-   PSB is created with a process called PSB generation or PSBGEN, very similar to the
    DBDGEN process; wherein DBA codes a series of control statements
-   PSBGEN control statements are Assembler Language Macros supplied by IBM and
    submitted via JCL invoking a catalogue procedure called PSBGEN producing an
    OBJECT module.
-   Macros are stored in Maclib and Load modules are stored in PSBLIB, which is the
    PSB itself and ready for loading
-   The PSB control statements for a Retrieved program will look as below.
-   Each PSB consists of one or more control blocks called Program Communication
    Blocks or PCB's. Each PCB within a PSB defines exactly one Logical Data Structure
-   All the PCB's within a single PSB are collectively known as an Application Data
    Structure
-   It is possible that more than one program may share a single PSB, however, no
    program can use more than one PSB in a single execution
-   The Logical Data Structures defines all the segments that an application program may
    access using that PSB
       SENSEG        - These statements identify the segments in the database that this
                     application program is sensitive to. NAME operand names a segment that
                     is sensitive and must be the same as the name coded in the NAME
                     operand in the SEGM statement in the DBD. PARENT operand names a
                     segment that is parent to the SENSEG name. This operand identifies the
                     hierarchical structure of this Logical Data Structure as supported by the
                     DBD. The PROCOPT operand is optional. It stands for the processing
                     options and identifies the processing types that may be performed on each
                     segment by the application program. 'K' means that the segment is key
                     sensitive only. The application may use the segment only to gain access to
                     the segments below it in the hierarchy and not to access any data within it.
                     If a sensitive segment is not key sensitive, it is data sensitive i.e. when
                     PROCOPT = G, I, R or D or A. Any or all of GIRD may be specified in
                     any order.
       PSBGEN        - Identifies the language of the program that will use the PSB and gives a
                     name to PSB coded at the end.
− Note
1. The sensitive segments must be specified in the hierarchical sequence as in DBD. Such as
   Top to Bottom, Left to Right
2. If the PROCOPT operand value is same for all the entries of SENSEG within a PCB then
   you may specify PROCOPT operand in the PCB statement itself instead of in each SENSEG.
   If PROCOPT operand is specified in both, the SENSEG entry overrides the PCB entry.
   However, the PROCOPT = L (Load - to create the initial version of the database) may be
   specified only in the PCB statement which cannot be overridden. Also, the PROCOPT = K
   (Key sensitivity) may be specified only in the SENSEG statement.
3. For Field Level sensitivity within a sensitive segment include the statement SENDFLD
   immediately following the statement SENSEG as
              SENDFLD        NAME = fieldname, START = position
              SENDFLD       NAME = fieldname START = position
       Name and the Field Length are inherited from DBD. The order in which field names are
       specified is irrelevant
       //RETRIEVE              EXEC              PGM=DFSRRC00, PARM=DLI, PATRETRV
       //STEPLIB               DD                DSN=IMSVS.RESLIB, DISP=SHR
       //                      DD                DSN=IMSVS.PGMLIB, DISP=SHR
       //IMS                   DD                DSN=IMSVS.PSBLIB, DISP=SHR
       //                      DD                DSN=IMSVS.DBDLIB, DISP=SHR
       //SYSUDUMP              DD                SYSOUT=A
       //HOSPSET               DD                DSN=IMS.VSAM.HOSPSET, DISP=OLD
       //HOSPFLW               DD                DSN=IMS.VSA.HOSPFLW, DISP=OLD
       //OUTPUT                DD                SYSOUT=A
       //INPUT                 DD                A
                               -------------------------------------
                               -------------------------------------
                               -------------------------------------
                               (INPUT TRANSACTIONS)
                               -------------------------------------
                               -------------------------------------
–Under IMS, the Batch Initialization Module DFSRRC00 is invoked via JCL which in turn loads
the application program and the DL/I modules required to service it.
–Under IMS, a batch DL/I program executes as a sub-program of DL/I even though the program
invokes DL/I services by issuing DL/I calls. The program and the DL/I modules execute together
–DFSRRC00 is the DL/I load module called as the Region Controller
–A convention, which is required for IMS-DC programs and optional for IMS-DB batch
programs, is that the Load module name and the PSB name should be the same. They are
specified in the PARM operand of EXEC statement. If the program name and PSB name is
different, DL/I allows to specify both names in the PARM operand.
–With the help of NAME operand in the PCB statement of PSB, IMS system loads into memory
the DBD of Database required
–With the help of DD names in the DATASET statement of DBD, the execution JCL describes
the physical file in the DD statements for the Database storage
–The other DD statements are required by DL/I
                    6. DL / I PROGRAMMING
                       CONSIDERATIONS
        -   The application program is treated as a subroutine of DL/I and standard subroutine
            Linkages and Parameter lists are used to connect the application program to the DL/I
            modules that passes control to it.
        -   When DL/I links to the application program, it passes to the program a parameter list
            containing the addresses of the PCB's in the PSB
OPERATING SYSTEM
                                              DL / I
   IMS
 Address
                             PSB                         DBD
  SPACE
                                                                                      Database
    Or
 REGION
                                     APPLICATION PROGRAM
    -   PCB masks for the PCB's passed to the program by DL/I is coded here
    -   The data names describe the data areas in the PCB mask for the PCB's that DL/I
        loaded
    -   Must for every DL/I program since PCB is a DL/I control block that is loaded into
        memory by DL/I before the program is executed.
    -   When a DL/I call is issued, the PCB mask must be specified to indicate which
        PCB (database) in the PSB is to be used to process the call
    -   DL/I updates the PCB mask with the execution results after every DL/I call
Function Code: -           This is the first parameter in the list. It names a four byte
                           function code for the service requested from DL/I such as
                           Insert, Update, Delete, and Browse of database. A function
                           table Copybook called DLI CALLS is copied in the
                           application program using the command COPY DLI
                           CALLS
PCB Mask Name: -           This is the second parameter in the list. It names the PCB
                           mask of the Database this DL/I call in use.
                           –After execution of the DL/I call, IMS will load the PCB
                           mask specified in the call with the execution result.
                           –The fields in the PCB mask structure are as follows
DBDNAME                    The DBD name of the database the call tried to manipulate
                           upto 8 characters long
LEVEL NUMBER               The level number of the last segment encountered which
                           satisfied a level of the call. When the retrieval is
                           successfully completed, the level number of the retrieval
                           segment is placed in this field. The level number is two
                           bytes, Right Justified, Decimal Number field
STATUS CODE                After the execution of every DL/I call, this field is updated
                           with a two-character code, which indicates the result of call
                           execution. If the execution is successful this field is blank
                           else appropriate status code for the service requested will
                           be returned by DL/I
PROCESSING     This is a four byte left justified field in which the
               processing
OPTIONS        Options for the type of calls allowed in a program for the
               database specified in the PCB statement of PSB is returned
               by DL/I. The processing options are specified by
               PROCOPT operand.
JCB ADDRESS    This is a four byte field reserved for DL/I containing a four
               byte address of an Internal Control Block called the JCB.
               An area within JCB keeps track of the most recent calls.
SEGMENT NAME   This is an eight-byte field with the name of the last segment
               encountered which satisfied a level of the call. When the
               call execution is successful, the name of the retrieved
               segment is updated here, else the name of the segment
               along the path that satisfied the search condition.
KEY LENGTH     This is a field giving the length in bytes of the concatenated
               key of all the segments along the key values of all the
               segments along the retrieval path string together. This is a
               four-byte field.
NUMBER OF      This field contains the number of the segment types within
SEGMENTS       the database to which the application program is sensitive
               to as specified in the SENSEG statements of the PCB in the
               PSB. This is a four-byte field.
KEY FEEDBACK   Contains the actual concatenated key values of all the
AREA           segments along the retrieval path upto the last segment
               encountered which satisfied a level of the call. The key
               fields are positioned from Left to Right, beginning with the
               Root segment key value. This field is a variable field
               structure depending upon the segments of a database. Rests
               of the fields have a standard format and fixed length. This
               field contains the key values or even though the segment
               may be retrieved using a search field. A segment with NO
               KEY field will skip that level in the concatenated key.
       INPUT-OUTPUT                  This is the third parameter in the list. This area is used by
       AREA                          DL/I to put a retrieved segment or by the application
                                     program to store the date of a segment prior to addition or
                                     updation. If a single segment occurrence is received,
                                     inserted or updated this area should be the segment layout
                                     area. The I-O area must be large enough to contain the data
                                     of the largest segment type. After determining which
                                     segment is retrieved move the segment contents to an area
                                     describing it. Another option is to use the REDEFINES
                                     clause to describe each segment type in the Hierarchy path.
− Note
The first three parameters in the List Function Code, PCB address, I-O area are Required when
retrieving a segment using DL/I call. Optionally you can also specify a Segment Search
Argument to further describe and qualify the retrieval call.
       For example, to retrieve a specific patient in a ward of a hospital will require 3 SSA's to
       be coded in the card.
       WORKING-STORAGE SECTION
       1   PATIENT-SEGMENT
           5     ------
           5     ------
           5     ------
       1   HOSPITAL-SSA
           05    FILLER    PIC X(19) VALUE 'HOSPITAL (HOSPNAME = '
           05    HOSPNAME PIC X(20)
           05    FILLER    PIC X    VALUE ')'
       1   WARD-SSA
           05    FILLER    PIC X (19) VALUE 'WARD (WARDNO ='
           05    WARD NO PIC X(2)
     05      FILLER           PIC X     VALUE ')'
1    PATIENT-SSA
     05      FILLER           PIC X(19) VALUE 'PATIENT (PATNAME = '
     05      PATNAME          PIC X(20)
     05      FILLER           PIC X     VALUE ')'
LINKAGE SECTION
1    PCS-MASK
     -------
     -------
     -------
PROCEDURE DIVISION
The above three SSA's work together in a call to retrieve patient whose name is BROWN
from the ward no. 2 in hospital RIVEREDGE. This is a unique occurrence in HOSPITAL
database.
      –Unqualified     SSA :- This only specifies the SEGMENT TYPE the program is
      interested in. Here you don't indicate a particular occurrence of a segment because you
      don't care which occurrence of a segment you get. The segment name is first eight
      characters padded by space upto the eighth position followed by a space in the ninth
      position instead of a left parenthesis. For example - HOSPITAL. This will retrieve the
      first occurrence of HOSPITAL segment.
      –Qualified SSA: - This is addition to the SEGMENT TYPE, also contains one or more
      qualification statements. A qualified SSA describes the segment occurrence a program
      wants to access. This description is called a qualification statement having 3 parts. A
      qualified statement is enclosed in parenthesis. The part names the field that DL/I will use
      for segment search. The second part names the Relational Operator of two bytes telling
      DL/I what kind of comparison to make during the search. The third part is a variable
      length field that contains the values for comparison during DL/I search. Can code more
      than one qualification statement.
      –Fully Qualified SSA: - The SSA's give complete information about each segment
      occurrence in the search hierarchy path.
− Note
In the ninth position of SSA
               –A BLANK indicates unqualified SSA
               –A LEFT PARENTHESIS indicates qualified SSA
An ASTERISK indicates one or more command codes
6.8 CALL TYPES
–Without    SSA: - This is an unqualified call and DL/I assumes this to be an unqualified
SSA also for the ROOT segment Level. The first occurrence of root segment is retrieved.
–With   Unqualified SSA: - This is a qualified call and DL/I will locate the first
occurrence of segment types specified in the call. For example
       GU      HOSPITAL
               WARD
               PATIENT
This will retrieve the first occurrence of PATIENT segment under the first occurrence of
WARD segment under the first occurrence of HOSPITAL segment.
–With   Assumed Unqualified SSA: - If any segment type is either not specified for
any levels in the hierarchy path above the segment being retrieved (i.e. Missing Levels)
or is specified without any Qualification Statement (i.e. Skipped Levels), DL/I will
assume an Unqualified SSA for each missing or skipped segment types.
For example
For example:
               GU      HOSPITAL (HOSPNAME = MACNEAL )
                       WARD     (WARDTYPE = INTENSIVE)
Any search field or the key field may be referenced in an SSA. The above example will
retrieve the segment WARD whose ward type is INTENSIVE. One SSA is needed to
retrieve the segment HOSPITAL, coded as
        GU      HOSPITAL (HOSPNAME = MACNEAL )
–With Combinations of Qualified and Unqualified SSA's: - The way DL/I
handles these calls depends upon the level at which the unqualified SSA's are coded.
       For example
       This will retrieve the first occurrence of the PATIENT segment in WARD No 02 of
       Hospital name RIVEREDGE
For example
              GU      HOSPITAL
                      WARD
                      PATIENT (PATNAME = WHEELER)
       Unqualified SSA's at higher levels such as HOSPITAL and WARD segment types and
       qualified SSA's at the lower levels at PATIENT segment type only tells where DL/I is to
       begin its search. DL/I does not limit its search to only those patient segment occurrences
       under the first occurrence HOSPITAL. Instead, DL/I searches all the way through the
       database until it reaches the occurrence of patient segment where the Patient is
       WHEELER. In this case the two unqualified SSA's tell DL/I to locate the second segment
       and start the search from there since we don't know in which Hospital and ward the
       patient WHEELER is admitted.
− Note
Also specifying GU PATIENT (PATNAME = WHEELER ) wherein the segment types WARD &
HOSPITAL are skipped in the call. DL/I will assume an unqualified SSA for the skipped
segment types. The effect of the call is same as that of above example in which the levels are
expressly unqualified in the call.
       = or EQ        Equal
       > = or GE      Greater than or equal to
       < = or LE      Less than or equal to
       > or GT        Greater than
       < or LT        Less than
       ¬ = or NE      Not equal to
 6.11 HOSPITAL DATABASE SEGMENT
      OCCURRENCE CHART
1  HOSPITAL
MAC NEAL
                2      WARD
                01 / 018 / CARDIOVASC
                                        3       PATIENT
                                        VEENA / 0003 / 082377
                                        4       PATIENT
                                        SHEENA / 0008 / 071477
                                        5       PATIENT
                                        MEENA / 0017 / 091377
                6      WARD
                04 / 017 / GASTRO
                                        7       PATIENT
                                        HERO / 0004 / 051477
                                        8       PATIENT
                                        ZERO / 0008 / 060277
                9      WARD
                08 / 000 / INTENSIVE
                                        10        PATIENT
                                        WHEELER / 0001 / 081177
                                        11       PATIENT
                                        PEELER / 0002 / 080477
                                        12        PATIENT
                                        TRAILER / 0003 / 072877
                                        13        PATIENT
                                        BOILER / 0004 / 071877
                                        14        PATIENT
                                        JAILOR / 0005 / 080577
                                        15        PATIENT
                                        SAILOR / 0006 / 080177
16   HOSPITAL
RIVEREDGE
                17      WARD
                02 / 021 / PEDIATRIC
                                        18      PATIENT
                                        MUNNU / 0003 / 061477
                                        15      PATIENT
                                        CHUNNU / 0005 / 052277
                20      WARD
                04 / 008 / ORTHOPEDIC
                                        21       PATIENT
6.12 RANDOM RETRIEVAL USING GU CALL
–This retrieves a unique segment occurrence randomly
–This is a fully qualified call wherein the program supplies a fully qualified SSA for each
level in the hierarchy down to the segment being retrieved.
–GU call is also used to set up the Parentage at the retrieved segment occurrence for the
subsequent GNP or GHNP calls issued in the program to retrieve its dependants
sequentially.
For example
–Two status values are returned by DL/I in the status code field of PCB after executing
the call using GU function
                                     2                                    16
Second Level                 WARD        13                        WARD
                                 3                      14                     17
Third Level           PATIENT        9        PATIENT              PATIENT
                        10             11     12                    18                19
Fourth Level          SYMPTOM        TREATMNT DOCTOR               SYMPTOM          TREATMNT
20
21
                 4           5                    7                                       22
           SYMPTOM    TREATMNT 6              DOCTOR         8                        DOCTOR
Figure 5
− Note
1. Reading sequentially through the database with an unqualified GN call, will retrieve different
   segment types at different levels
      First call retrieves a segment at the first or Root level (1)
      Second call retrieves a segment at the second level (2)
      Third call retrieves a segment at the third level (3)
      Fourth call retrieves a segment at the fourth level (4)
      Fifth, Sixth, Seventh, Eighth call retrieves segments at fourth level (5,6,7,8)
      Ninth call retrieves a segment at the third level (9)
      Tenth call retrieves a segment at the fourth level (10)
      Eleventh & Twelfth call retrieves segments at the fourth level (11, 12)
      Thirteenth call retrieves a segment at the second level (13), thereby moving from
      Level four to level two in one call.
2. An important issue to be considered in sequential calls is the concept of position within the
database.
   When issued at the beginning of program execution, position would be established at the
   beginning of the database; and the call would retrieve the first patient segment 3. Next
   issue of the same call will retrieve the next patient occurrence in segment 9. Next issue of
   the same call will retrieve the next patient occurrence in segment 14. Next issue of the
   same call will retrieve the next patient occurrence in segment 17. Finally, the next issue
   of the same call would cause DL/I to return a GB status code since no more patients
   segments exist in the Hospital Database.
− Note
–The above status codes do not indicate error conditions
–Each GN call that retrieves a segment of the same type, or retrieves a segment lower in the
hierarchy than the last one will return a BLANK status code.
–GA does not tell how many levels up, the position moved since the last call.
–One more GN call after returning a GB status code, DL/I will position itself at the beginning of
the database.
6.18 SEQUENTIAL RETRIEVAL USING GNP CALL
–Performs sequential retrieval very similar to the GN function, except that it retrieves
only segments that are subordinate to the currently established parent.
–Parentage must be established by issuing either a GU or GN call, in which case DL/I not
only establishes a position on same segment occurrence, but it also, establishes parentage
on that occurrence.
–The segment retrieved by the GN or GU call is treated as the parent segment for any
subsequent GNP calls issued in the program.
–The GNP calls return only those segment occurrences that are
–Next GNP call without SSA will retrieve the first word segment that is segment 2
–Further GNP calls without SSA will scan through the database and retrieve in
hierarchical sequence all the segments that are dependent on Mac Neal Hospital Segment.
The last one being segment 14
–One more GNP call after segment 14 would return a status code of GE indicating no
more segments under the established parent. That is segment no.1
–The lower in level that parentage is established, the fewer segments an unqualified GNP
call has access to.
Assume this establishes parentage; say at segment 3 in database, the patient segment for
patient Munnu.
–Next GNP calls without SSAs would only have access to segments 4, 5, 6, 7, and 8 in
the database
–One more GNP call after segment 8 would return a status code of GE indicating no
more segments dependant on segment 3. That is the patient name MUNNU.
6.20 GNP call with Unqualified SSA's (Qualified GNP call)
       –GNP calls with unqualified SSA's will sequentially retrieve only segment of the
       particular segment type.
GNP PATIENT
       In this case, GNP calls that specify an unqualified SSA for the Patient segment retrieves
       the segments 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 and 14 in the first database record that is
       segment no. 1 for Mac Neal Hospital
       However, if an unqualified GNP calls are issued with segment no. 1 as the established
       parent, even ward segments no. 2 and 13 would be retrieved as well in the sequence along
       with the above segments.
− Note
–Results could be dramatically wrong if a mistake is made in establishing parentage before
issuing GNP calls.
–While coding a qualified GNP call do not include SSA's for segments at a level higher than or
equal to that of the currently established parent segment. If you do, DL/I will return a GP status
code.
6.21 GNP call with Qualified SSA's (Qualified GNP call)
       –GNP calls with qualified SSA's can be used when performing Skip-Sequential
       Processing.
       –Perform a series of GNP calls using SSA only for the segment type being retrieved.
       Assume, this established parentage at ward no 01 in Mac Neal Hospital, say at segment 2
       in the database.
       Now, issuing GNP calls with a single qualified SSA for the patient segment instead of
       GN calls, the program has automatically limited the area of search to only there segments
       which are dependant on ward no. 1. That is segment 2.
       If GNP calls are replaced y GN calls with the single SSA, this would read through all the
       patient segments in the database, rather than stopping at the end of Ward No. 1 segment.
− Note
–A GP error code is returned by DL/I, which almost always represent a Programming ERROR as
below :-
–If a GNP call is issued without first establishing parentage on a segment by a GU or GN call.
–If the GU or GN call is issued to establish the parentage is not executed successfully before the
GNP call was issued.
–An established parent segment is deleted before the GNP call depending on that parent is
issued.
–If the SSA's coded in the GNP call contains errors
    7. UPDATING AND DELETING
            SEGMENTS
–Updating and Deleting segments always requires the program to perform a sequence of
two calls.
–The first call being a GET HOLD function to retrieve the segment that the program
intends to Update or Delete
–The second call being a REPL or DLET function to perform the replacement or deletion
of the segment eventually.
–Any intervening calls between the first and the second call will nullify the effect of the
GET HOLD call. The practical implication of this is that the program can proceed with
the other processing if it is decided not to go ahead with the replacement or the deletion
of the segment. Hence any explicit action to cancel the effect of a get hold call is not
required in the program.
Rule No.2 - Should not issue any other call using the same PCB, between the time a
Get Hold call is issued and the time a Replace or Delete call is issued, unless that other
call is also a Get Hold call.
Rule No.3 - Should not normally code SSA's in the Replace or Delete calls except
when the Get Hold call is with one or more SSA's using the D command code.
Rule No.4 - The KEY field in the segment cannot be modified before the REPL or
DLET calls.
7.3 REPLACING SEGMENTS IN THE DATABASE
    USING THE REPL FORM
–Must issue a Get Hold call to retrieve the segment data into I-O area.
–Changes can be made to the data in I-O area except the KEY field.
–Issuing a REPL call will cause changes to the segment to be rewritten to the database.
–If the Get Hold call is a Path call issued with one or more SSA's using the D command
code, a REPL call can be issued with SSA's
–The SSA's can be Qualified or Unqualified
–The SSA's must use N command code for those segments whose data you DON'T want
to be rewritten to the data.
–If the REPL call is issued without SSA's, it operates all the segments retrieved along the
path and all the segments in the path will be rewritten to the database.
–If the ISRT call is issued with a qualified SSA, describing the path along with the
insertion is to be made, with an unqualified SSA for the segment being inserted with an
–If the inserted segment occurrence has a unique key field DL/I uses the key of the new
segment to determine where
             9. DBD INSERT RULES
–When DBA defines a segment type that does not have a key field, or has a non-unique
key field, it is necessary to tell DL/I where to insert the new segment occurrences for that
segment type in the twin chain.
–The RULES operand of the SEGM statement of DBD tells DL/I how to handle segment
insertions in such situations.
–RULES operand has three options that tells DL/I where in the twin chain to insert the
new segment which does not have a unique key field. They are as follows
FIRST - Says that the new segment will always be inserted at the beginning of the twin
chain.
LAST - Says that the new segments will always be inserted at the end of the twin chain.
This is the default.
HERE - Says that the new segment will be inserted after the segment at which the
program within the twin chain establishes the current position before the ISRT call is
issued. If the current position is not established before inserting the new segment, with
this rule, a new segment occurrence is always inserted at the beginning of the twin chain
if no position is established within the twin chain.
–DL/I uses the key field to find the approximate position within the twin chain to insert
an segment that has non-unique key field. The insert rule is then applied to determine
where to insert the new segment occurrence relative to all the segments having the same
non-unique key value. First, tells DL/I to insert the new segment at the beginning of all
those segments having the same non-unique key value. Last, tells DL/I to insert the new
segment after all those segments having the same non-unique key value. Here, tells DL/I
to insert the new segment within the twin chain after establishing the current position
within it. If the appropriate key value position is not established, DL/I will insert the new
segment at the beginning of the set of segments having the same key value.
IX - Encountered an Insert Rule Violation. Program tried to insert a segment into the
wrong place in the database. For example: A patient segment is being inserted under the
Facility segment, when it is in fact dependent upon the Ward segment.
9.2 LOADING SEGMENTS INTO AN EMPTY OR
    SCRATCH DATABASE
–ISRT call is also issued to load a database with segments from the scratch
–PCB for the database in the PSB should specify as processing options L or LS in the
PROCOPT operand for permitting loading of segments in the Ascending sequence in the
Load mode
–Insert commands in Load Programs normally load segments in Ascending sequence
only with certain exceptions.
–One important rule for ISRT call is that the segment being loaded or inserted must be
identified in an single unqualified SSA, since qualified SSA is not valid.
–Programs designed to Load databases normally use ISRT calls with Unqualified SSA
–Segments must be presented to the Load Program in the Hierarchical Sequence. It
means that root segments must be presented to the load program in root key sequence and
all dependant segments must be presented in hierarchical sequence following each root
key.
–The appropriate segment name for the segment type being loaded is moved into the
Unqualified SSA are before
–DL/I gets the Qualification information for the segment being inserted from I-O area
–It is however valid to include Qualified SSA's to completely describe the path with a
restriction that the SSA for the segment being loaded cannot be qualified. Also, you
cannot include SSA's at levels lower than the level at which the segment is being loaded.
                                       TEST EXPRESSION
10.2 SSA'S USING COMMAND CODES
–Command codes in a SSA makes the call powerful since DL/I treats such SSA'S
differently from those without the command codes while performing some special
functions.
–Command codes save programming and processing time
–Command codes are specified in an SSA following the segment name and an Asterisk '*'
–An Asterisk '*' in the ninth position in a SSA indicates that one or more command codes
follow the asterisk
–A Blank or Left Parenthesis marks the end of command codes
–ONE or MORE command codes can be used in any combination
–Ten command codes are available under IMS
        F - Locate First Occurrence
        L - Locate Last Occurrence
        D - Retrieve this segment data into the I-O Area (Path Call)
        N - Do not replace this segment
        C - Concatenated key in this SSA
        Q - Enqueue this segment
        U - Maintain current position at this level
        V - Maintain current position at this and higher level
        P - Establish Parentage at this level
        - - Null command code
–Command codes in a Qualified SSA
        WARD*D(WARDNO=03)
        WARD*DNP(WARDNO                =03)
–Command codes in an Unqualified SSA
        WARD*PD
10.3 F COMMAND CODE
–Tells DL/I to begin the search with the first occurrence of this segment type in a twin
chain under its parent.
–It can be used only with GN, GNP, GHN and GHNP calls
–In a retrieved call this command code allows the segment occurrence to be inserted as
first occurrence in the segment type which has non-unique or no key field and
RULES=HERE is specified for this segment in the DBD.
–Suppose you search through all the treatment segments under a particular patient
segment occurrence for a treatment type of Morphine. If you find one, you would like to
print all the Treatment occurrences for that patient.
In the above example you have to get the key value of the ward segment out of the PCB
every time Step 2 of the procedure is executed. Store the key value into the qualified SSA
in Step 4 before starting the loop that retrieves the Patient segments. This keeps the GNP
calls within the same domain in the database. GE status code is returned by DL/I after
you run out of Patient segments for each Ward, just as though you had established
parentage at the Ward Level for getting the necessary Control Breaks.
                              WITH U COMMAND CODE
In the above example coding a U command code in an unqualified SSA has the same
effect as using a qualified SSA at that level. Using U command code at the ward level
tells DL/I to maintain the current position established on the ward segment level.
       GNP     WARD * U
               PATIENT * U
               SYMPTOM
                 (OR)
       GNP     PATIENT * V
               SYMPTOM
In the above example, V command code causes DL/I to act as though U command code
were set at that level, and at all the levels above it. The two sets of SSA'S are functionally
the same. The command saves the trouble of coding U command codes in SSA'S at each
higher level.
By using a P command code, you saved one call by retrieving the first patient segment in
the Get Unique call itself and setting the parentage at the ward level.
WARD 2 FACILITY 20
PATIENT 3
PATIENT 13
15 17 19
5 8 11
6 9 12
Figure 6
           –In the above Hierarchy assume that there is a one to one relationship between
           SYMPTOM, TREATMNT and DOCTOR segments. For each SYMPTOM segment there
must be a corresponding TREATMNT and DOCTOR segments. This type of relationship
between the segment types in the database illustrates the need for Multiple Positioning
for some types of Sequential Retrievals
With the above sequence of calls we will first retrieve all the SYMPTOM segments,
followed by all the TREATMNT segments, followed by all the DOCTOR segments.
However, this is not what we want because what we really like to do in this case is to first
retrieve the SYMPTOM segment, followed by a TREATMNT segment, followed by a
DOCTOR segment.
This will work only for the first execution of above call sequence retrieving segments 4, 7
and 10. But the second execution will return a GE status code indicating there are no
more SYMPTOM segments under that Parent i.e. PATIENT whose BEDIDENT = 1012.
To get the next SYMPTOM segment, DL/I will have to remember the position of the last
SYMPTOM segment retrieved, as well as the positions of the last TREATMNT and
DOCTOR segments.
Suppose we code
                  GU     HOSPITAL (HOSPNAME = RIVEREDGE)
                         WARD(WARDNO = 02 )
                         PATIENT  (BEDIDENT = 1012 )
                  GN     SYMPTOM
                  GN     TREATMNT
                  GN     DOCTOR
           This time the sequence of segments retrieved will be 4, 7, 10, 14, 16, 18 followed by a
           GE status code. This call sequence will go through the entire database retrieving only the
           first occurrence of the SYMPTOM, TREATMNT and DOCTOR segment under each
           PATIENT segment.
           Now, retrieving with Multiple Positioning, DL/I maintains a separate Unique position
           within the Database Record for each Dependent Segment Types at each level in each
           Hierarchical Path. A chart below illustrates this
HOSPITAL
A WARD B FACILITY
C PATIENT
Figure 7
− Note
That you cannot maintain two positions on the same segment type. Also, the separate positions
are maintained only on the segments dependent upon a particular parent.
Assuming that Multiple Positioning is in effect, the first time we retrieve segments 4, 7
and 10. The second time we retrieve segments 5, 8 and 11 using GNP calls. The third
time we retrieve segments 6, 9 and 12 using GNP calls.
This is possible because DL/I maintains a different position for each segments at D, E
and F in the hierarchy chart above.
HOSPITAL
WARD FACILITY
PATIENT NAME
Figure 8
                                              HOSPITAL
                                            WARD
PATIENT
BILLING
− Note
A new segment type called the PBILL segment is created. Each occurrence of it points to the
appropriate occurrence of the BILLING segment in the HISTORY database.
       –A new logical DBD, which maps against two physical DBD'S defining the logical
       structure above, is coded.
       –PSB'S requiring access to the logical structure above would now reference the logical
       DBD rather than either one of the Physical DBD'S
       –In Logical Relationships Terminology
       –PBILL segment in the HOSPITAL physical database is called a LOGICAL child
       segment.
       –PATIENT segment for PBILL segment is Physical Parent Segment BILLING segment
       in the HISTORY physical database to which PBILL segment is pointing to is called a
       Logical Parent Segment.
       –This is a Unidirectional Logical Relationship and the advantage is that the BILLING
       information exists in only one place in the HISTORY physical database.
       –PBILL and BILLING segments are logically related
When a logical child is accessed through its Physical Access path, the destination parent is its
Logical parent. But when it is accessed through its Logical access path, the destination parent
10.16         DBDGEN'S FOR PHYSICAL DATABASE
              WITH LOGICAL RELATIONSHIPS
–A logical relationship is implemented by specifying them in the DBDGEN for the
physical database involved.
       SEGM          NAME=PBILL
                     PARENT=((PATIENT, DBLE), (BILLING, HISTDBF))
IMSVS.PGMLIB               This dataset contains all the IMS application program load
                           modules. Specified in STEPLIB or JOBLIB
IMSVS.PSBLIB               This dataset contains all the generated PSB'S used by the
                           application program during execution. Specified in IMS
                           Ddname.
IMSVS.DBDLIB               This dataset contains all the generated DBD'S used by the
                           application program during execution. Specified in IMS
                           Ddname.
IMSVS.MACLIB               This dataset contains the definitions of the Macros that are
                           used to generate the PSBGEN and DBDGEN macros.
When a program is executed, IMS must combine the information in your DBD and PSB
before the execution could begin. To save IMS this trouble each time the program
executes, the DBA may choose to merge the DBD and PSB information ahead of time.
To do this, a procedure called ACBGEN, which stands for Application Control Block
Generation is executed. Once generated, the execution JCL must reference
IMSVS.ACBLIB rather than the PSBLIB and DBDLIB. The use of this dataset is
optional for Batch DL/I programs, but is required for MPP and BMP programs.
                    11. APPENDIX - A
11.1 Processing Options - PROCOPT =
G - Get functions GU, GN, GNP, GHU, GHN, GHNP
I - Insert function ISRT
R - Replace function REPL. Also implies G.
D - Deletes function DLET. Also implies G
A - All includes above four functions G, I, R, D
P - Required for Path calls if D command code is to be used in the SSA for the segment.
O - Get calls only, and no Get Hold calls are allowed. If you specify GO or GOP, then
     only Get calls like GU, GN, GNP are allowed. If specified for all the PCB'S in the
     PSB, then you can execute a DL/I Batch program without making the on-line
    Databases off-line.
E - Enqueue the segment or database for on-line program. This facility allows MPP
    programs to exclusively use this resource in a Multitasking environment.
L - Load function for database initial loading
GS - Get segments in Ascending Sequence only (HSAM)
LS - Load segments in Ascending Sequence only.
Default - Parameter by Default is a (All)
K - The segment is key sensitive only, cannot access data.
                    12. APPENDIX - B
12.1 DL/I STATUS CODES
AB - The call did not specify a segment I-O area (All)
AC - SSA with a hierarchical error. (Get & ISRT)
AH - Call requires atleast one SSA (ISRT)
AI - Error encountered when trying to open the database dataset. An error in the JCL DD
    Statement. (All).
AJ - The call specifies an Invalid SSA
AK - The field named in a qualified SSA is not correct (All get calls and ISRT)
AM - Call attempted an unauthorized operation not allowed by the processing options or
       Sensitive segments specified in the PCB (all calls)
AO - Call caused an operation resulting in a physical I-O error (All calls)
AT - The I-O area specified in the call is too large, but the program's PSB may be
      incorrect. (DLET, REPL and ISRT calls)
DA - The sequence field with key (non-replaceable field) has been changed in the
      program's I-O area. (DLET, REPL calls)
DJ - No preceding Get Hold call for a Delete or Replace operation (DLET, REPL calls)
                    13. APPENDIX - C
13.1 SYSTEM SERVICE - DL/I CALLS
–There are eight DL/I calls using which IMS performs various system services functions.
–Four important calls are listed below
The I-O PCB must be the first PCB listed on the ENTRY statement normally used for
data communication programs. Checkpoint-ID names a I-O area that contains an Eight-
byte value to identify a checkpoint record written to the log file. During recovery, this
eight byte Checkpoint-ID is used by IMS to Restart the program.
13.4 SYMBOLIC CHECKPOINT CALL
–Can be issued by a BATCH and BMP program
–Apart from committing changes made to the database, it also establishes position in the
program from where to Restart, in case the program abnormally terminates.
–The program can also save as many as SEVEN PAIRS of data area along with the
checkpoint record. These data areas are restored during the program restart.
–A symbolic checkpoint call works with the Extended Restart (XRST) call to restart the
program.
The I-O PCB mask must be the first PCB listed on the ENTRY statement normally used
for data communication programs having a format different from that of database PCB.
The CheckPoint-ID names a I-O area that contains an Eight-byte value to identify a
checkpoint record written to the log file. Now follows, upto SEVEN PAIRS of field
names defined in the working storage of a program the contents of which is to be saved
along with the checkpoint record. In each pair the first item contains the length of the
datarea to be saved, defined as a Binary field of Full word Type PIC S9 (5) comp, the
second field is the name of the data area storing the contents to be saved. For example
       1      FIRST-IO-AREA
              05    VALID-TRANS-COUNT              PIC S9(5) COMP-3 (3 BYTES)
              05    INVALID-TRANS-COUNT            PIC S9(5) COMP-3 (3 BYTES)
              05    CROSS-SALES-VALUE              PIC S9(7) V99 COMP-3 (5 BYTES)
       01     FIRST-AREA-LENGTH                    PIC S9(5) COMP VALUE + 11
13.5 RESTART CALL (XRST)
–The program that issued a symbolic checkpoint CHKP call must issue a restart call
(XRST).
–The XRST call, which is issued only once, does not have to be the first call issued in the
program, though it must be issued before any CHKP call.
–Whether a program is to be restarted or not is determined by DL/I with the help of
PARM parameter specified in the EXEC statement for the program in the execution JCL,
or the CheckPoint ID provided in the Restart Work Area
–If a program is to be Restarted, the XRST call indicates that the following checkpoint
call is a symbolic checkpoint.
–Any calls issued before the XRST call are not within the scope of Restart.
The I-O PCB Mask must be the first PCB listed on the ENTRY programs having the
longest segment length is the name of a Full Word Binary field of PIC S9(5) comp that
contains the length of the longest segment area or path of segments the program
processes. DL/I uses this value to acquire the buffer area during a program restart. The
restart work area must be set to BLANKS if the program us not to be Restarted.
However, a Restart is performed when the Restart Work Area is not blanks or the
Checkpoint-ID to be used is provided by the PARM parameter specified in the EXEC
statement for the program in the execution JCL, in which case IMS places the
Checkpoint-ID value in the Restart Work Area automatically. The total number of I-O
areas specified in a call must be less than or equal to the number of areas specified in the
CHKP call and IMS restores only those areas within the program during a program
Restart.
13.6 ROLLBACK CALLS (ROLL AND ROLB)
When issued, will backout all the database updates made by the program since the most
recent Checkpoint. This will nullify the effect of any incorrect processing done by the
program.
ROLL CALL
–When issued, the program is Abnormally Terminated with a user Abend code of 0778
–It also deletes any messages for the program that have been retrieved from the message
queue since the last checkpoint before termination.
–It can be issued in a Batch program
ROLB CALL
–When issued, Dequeues all the segments, which have been Enqueued by the call using a
'Q' command, code. Q command code is used to establish an Exclusive control over a
segment by your program preventing others from updating the segment until your
program has released the exclusive control. This will ensure that the segment control will
maintain the same data whenever retrieved by the program till it is released.
–DEQ call may be issued for each class from A thru J
–DEQ call releases all the retrieved segments using the 'E' command code, except those
       –Segments modified by the program until the program issues a checkpoint.
       –Segments required to keep the position in the hierarchy until the position is
       moved to another record.
       –Class of segments that has been locked again as another class.