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

IMS Multiple Positioning


IMS provides two options for keeping track of position within a database: single positioning and multiple positioning. One and only one of these options is specified in the PCB statements of PSB. Note that single positioning or multipositioning is not a characteristic of a database, but it is how DL/I allows a program to view a database.

The same data base can be processed with either single or multiple positioning by different programs, which technique a program uses is determined by the program’s PSB. In terms of DL/I resource usage, there’s practically no performance difference between the two types of positioning.

PRINT   NOGEN
PCB     TYPE=DB,DBDNAME=CUSTDBD,KEYLEN=30,PROCOPT=A,
        POS=S
SENSEG	NAME=CUSTOMER
SENSEG	NAME=SHIPTO,PARENT=CUSTOMER
SENSEG	NAME=RECVABLE,PARENT=SHIPTO
SENSEG	NAME=PAYMENT,PARENT=RECVABLE
PSBGEN	PSBNAME=CUSTPSB,LANG=COBOL
END

The above PCB shows a situation where the single positioning option has been specified. Note that POS=S indicates single position. This can be made as multiple positioning by changing POS parameter to "M".

PRINT   NOGEN
PCB     TYPE=DB,DBDNAME=CUSTDBD,KEYLEN=30,PROCOPT=A,
        POS=M
SENSEG	NAME=CUSTOMER
SENSEG	NAME=SHIPTO,PARENT=CUSTOMER
SENSEG	NAME=RECVABLE,PARENT=SHIPTO
SENSEG	NAME=PAYMENT,PARENT=RECVABLE
PSBGEN	PSBNAME=CUSTPSB,LANG=COBOL
END

Single positioning allows IMS to maintain only one current position, and that position is always last hierarchical path referenced. When operating in the multiple position mode, IMS maintains a separate position for each dependent segment type at each level in the data base.

Consider the Logical view of the Customer Database shown below. Also Assume that there is a one-to-one relationship between ADJUSTMENT, PAYMENT, LINEITEM. To retrieve these segments, not being particular about the sequence of the segments, the following Get-Unique call followed by a series of Get-Next-Within-Parent calls accomplishes the retrieval.

logical view of imsdb customer database

Step1 :	GU CUSTOMER(CUSTNUM='DV0001')
           SHIPTO(SHPTOSEQ='01')
           RECVABLE(RSINVNUM='R00001')
Step2 :	GNP

With the above call all PAYMENT segments are retrieved first, followed by all the ADJSTMNT segments followed by LINEITEM segments. If one-to-one relationship between the segments needs to be maintained (While retrieving), the above call sequence is not appropriate. It would be better to retrieve a PAYMENT segment, followed by its corresponding ADJSTMNT segment, followed by the corresponding LINEITEM segment. Consider the call shown below.

Step1 :	GU  CUSTOMER(CUSTNUM='DV0001')
            SHIPTO(SHPTOSEQ=‘01’)
            RECVABLE(RSINVNUM=‘R00001’)
Step2 :	GNP PAYMENT
Step3 : GNP ADJSTMNT
Step4 : GNP LINEITEM
Step5 :	GNP PAYMENT
.........

In the above call sequence, the set of Get-Next-Within-Parent calls retrieve set of PAYMENT, ADJSTMNT, LINEITEM first time. If IMS is maintaining single position within a database, the Steps 2, 3, 4 works fine. But Step 5 returns a “GE” status code indicating that there are no more PAYMENT segments under the parent. This is because, Step 4 keeps the pointer position at first LINEITEM, which is later in the hierarchy (After all Payment and Adjustment segments, then comes, first Lineitem segment). To retrieve the second PAYMENT segment, IMS has to remember the position of the previous PAYMENT segment retrieved.

To achieve this requirement, Multiple Positioning is the correct choice. Once the multiple positioning is defined, the CUSTOMER database’ three hierarchical paths are considered as independent. They are as shown below.

hierarchical paths in the customer databse

If multiple position is being used and a PAYMENT segment is retrieved on a call to the CUSTOMER database, then IMS saves the keys of the segments in Path 1 of the figure shown above as the current position. If a LINE ITEM segment is retrieved on the next call, then IMS will save the current position in Path 3. Further more, if a ADJUSTMENT segment is retrieved on a third call, then IMS will also save the current position in Path 2. At this point IMS would be maintaining a current position in each of the three hierarchical paths. In other words, if multiple positioning is being used, current position in a given hierarchical path is not lost by subsequent retrievals in different paths.

GN and GNP calls always proceed forward from the Current position. Under multiple positioning, each hierarchical path may have its own current position. Thus, a search to satisfy a GN or GNP call still proceeds in a forward direction, but it proceeds from the last position in the specified hierarchical path.

GU and ISRT calls are affected by multiple positioning only if missing SSA levels must be implied by IMS. The rules of implication for multiple positioning are the same as those for single positioning. Since the rules for implied SSA’s depend on current position and there is a current position for each hierarchical path, caution should be taken to ensure that the desired parent segments will be implied.

DLET and REPL calls are not directly affected by multiple positioning. They are, however indirectly affected by Get Hold calls.


Advantages of Multiple Positioning:

  1. Greater degree of Data Independence.

    The use of multiple positioning allows the programmer to code programs which are insensitive to the order of segment types at a given hierarchical level. As shown above, program can issue calls for PAYMENT, ADJUSTMENT and LINEITEM segments in any desired order. In other words, multiple positioning allows programs to be written so that major changes to the physical structure of a database (such as changing the left to right order of segment types on a given level) do not necessitate the rewriting of these programs.

  2. Parallel Processing.

    The use of multiple positioning allows parallel processing of different segment types on a given hierarchical level. Consequently, it is possible to process ADJUSTMENTsegments, PAYMENTS segments, LINEITEM segments, and then return to process more ADJUSTMENT segments without losing current position in any of the separate hierarchical paths.



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