TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB Tools Articles Forum Quiz Interview Q&A

IMS ISRT Call


Inserting a segment(ISRT call):

The ISRT call is used to add a segment occurrence to a database. It can be used either for loading a new database or for inserting a segment into an existing database. There should be at least one SSA, an unqualified SSA, for the segment type that needs to be inserted. But, unless the call is fully qualified, DL/I uses the current position in determining where to insert a segment.

Suppose, if a RECVABLE segment is to be inserted under the SHIPTO segment whose sequence num. is '01' which is under the CUSTOMER with num. 'DV0001', the ISRT call may be issued as follows .

Step1 :	GU CUSTOMER(CUSTNUM='DV0001')
           SHIPTO(SHPTOSEQ='01')
Step2 :	ISRT	RECVABLE

The GU call in Step1 is issued to set the parentage at SHIPTO segment. Then the ISRT call is issued with an unqualified SSA. The segment that is to be inserted must always be identified with an unqualified SSA. If the SSA for the final segment, in the ISRT call, that is being inserted is qualified, DL/I gives an error. Thus, the RECVABLE segment can also be inserted as follows.

ISRT  CUSTOMER(CUSTNUM='DV0001')
      SHIPTO(SHPTOSEQ='01')
      RECVABLE

where the RECVABLE segment is left unqualified. If the ISRT call is issued as the one above then there is no need to issue a GU or GN call for establishing the parentage.

IMS knows whether the program is going to load a database from scratch or insert segments into an existing database from the processing options specified in the PCB. PROCOPT=L, allows the program to issue Insert calls in the load mode to load a database from scratch. A value 'LS' allows the program to issue Insert calls in the load mode and indicates that segments must be loaded in ascending sequence. Value 'A' allows the program to issue Get, Insert, Replace and Delete calls.

Value 'AS' allows the program to issue Get, Insert, Replace, Delete calls and indicates that new segments must be inserted in ascending sequence. With values 'A and AS', insert calls can only be used to insert segments into an existing database. Value 'I' indicates that only Insert calls in the insert mode can be issued. Value 'IS' indicates that only insert calls in the insert mode are allowed, and those segments must be in ascending sequence.


Segments with non-unique key or no key:

If the new segment has a unique sequence field, it is added in its proper sequential position. In some cases the lower level segment types in the database may not be having any key field. In some cases the key field may not be unique. In any one of these situations, there are some procedures to be followed.

The Segment type definition, SEGM statement, must contain information that tells IMS where to insert new occurrences of that segment type. The RULES parameter of the SEGM statement is used for this purpose.

SEGM    NAME=BUYER,PARENT=SHIPTO,BYTES=72,RULES=FIRST

The three available options for coding the RULES operand are FIRST, LAST, and HERE. This parameter, which is called as insert rule, tells IMS where in the twin chain to insert a new segment when a segment does not have a unique key field. The insert rule FIRST indicates that new segments are inserted at the beginning of the twin chain. The insert rule LAST indicates that new segments are inserted at the end of the twin chain. LAST is the default if no rules operand specified.

The Insert rule HERE indicates that the new segments are inserted in the current position. A new segment is inserted just before the segment on which current position is established. Note that with some limitations, F and L command codes will override the rules specified for segment insertion by the data base administrator. The possible combinations are:

  1. F and L command codes can override a rule of "Here".

  2. Command code L can override a rule of "First".

  3. Changing "First" to "Here" and overriding "Last" are not possible.

Though the position specified by insert rules is transparent to the user, it is advisable for the user to know these definitions, so that the DL/I calls can be coded effectively.


Status Code Check:

Following each ISRT call, the status of the call whether successful or not needs to be checked. There is a two-position field in the PCB called status code field. It keeps track of what happened as a result of the call.

When ISRT call is used to add segments to an existing database, the status codes for the following codes needs to be checked. " "(Blank), "GE", "II".

Blank indicates that the insert call is successful. Return Status "II" indicates that the segment occurrence tried to add is already existing i.e., duplicate. When multiple SSAs are used and when the DL/I cannot satisfy the call with the specified path, a status code "GE" is returned, which means at least one of the segment occurrences requested is not present.

When ISRT call is used to load the database, the status code check should include the following codes. " "(Blank), "LB", "LC", "LD", "LE".

Blank indicates that the insert call is successful. Status code "LB" indicates that the program tried to load the same segment twice. Status code "LC" indicates that the segments being loaded are not in hierarchical sequence. The status code "LD" indicates that no parent for segment being loaded. The status code "LE" indicates that the segment types are not being presented to the program in the right sequence.



If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!

Are you looking for Job Change? Job Portal