Advantages of using multiple positioning

The advantages of using multiple positioning include the following:
  • You might be able to design your program with greater data independence than you would using single positioning. You can write application programs that use GN and GNP calls, and GU and ISRT calls with missing levels in their SSAs, independent of the relative order of the segment types being processed. If you improve your program's performance by changing the relative order of segment types and all of the application programs that access those segment types use multiple positioning, you could make the change without affecting existing application programs. To do this without multiple positioning, the program would have to use GN and GNP calls, and GU and ISRT calls with incompletely specified SSAs.
  • Your program can process dependent segment types in parallel (it can switch back and forth between hierarchic paths without reissuing GU calls to reset position) more efficiently than is possible with single positioning. You indicate to IMS the hierarchic path that contains the segments you want in your SSAs in the call. IMS uses the position established in that hierarchic path to satisfy your call. The control blocks that IMS builds for each kind of positioning are the same. Multiple positioning does not require more storage, nor does it have a big impact on performance.
Remember: Multiple positioning might use more processor time than single positioning, and that multiple positioning cannot be used with HSAM databases.

How multiple positioning affects your program

Multiple positioning affects the order and structure of your DL/I calls.

GU and ISRT

The only time multiple positioning affects GU and ISRT calls is when you issue these calls with missing SSAs in the hierarchic path. When you issue a GU or ISRT call that does not contain an SSA for each level in the hierarchic path, IMS builds the SSA for the missing levels according to the current position:
  • If IMS has a position established at the missing level, the qualification IMS uses is derived from that position, as reflected in the DB PCB.
  • If no position is established at the missing level, IMS assumes a segment type for that level.
  • If IMS moves forward from a position that is established at a higher level, it assumes a segment type for that level.

Because IMS builds the missing qualification based on current position, multiple positioning makes it possible for IMS to complete the qualification independent of current positions that are established for other segment types under the same parent occurrence.

DLET and REPL with multiple positioning

Multiple positioning does not affect DLET or REPL calls; it only affects the Get Hold calls that precede them.

Qualified GN and GNP calls

When your program issues a GN or GNP call, IMS tries to satisfy the call by moving forward from current position. When you use multiple positioning, more than one current position exist: IMS maintains a position at each level in all hierarchic paths, instead of at each level in one hierarchic path. To satisfy GN and GNP calls with multiple positioning, IMS moves forward from the current position in the path that is referred to in the SSA.

Mixing qualified and unqualified GN and GNP calls

Although multiple positioning is intended to be used with qualified calls for parallel processing and data independence, you may occasionally want to use unqualified calls with multiple positioning. For example, you may want to sequentially retrieve all of the segment occurrences in a hierarchy, regardless of segment type.
Tip: Limit unqualified calls to GNP calls in order to avoid inconsistent results. Mixing qualified and unqualified SSAs may be valid for parallel processing, but doing so might also decrease the program's data independence.
The following rules apply to mixing qualified and unqualified GN and GNP calls:
  1. When you issue an unqualified GN or GNP, IMS uses the position that is established by the preceding call to satisfy the GN or GNP call. For example:
    Your program issues these calls: DL/I returns these segments:
    GU A (where AKEY = A1) A1
    GN B B11
    GN E E11
    GN F111

    When your program issues the unqualified GN call, IMS uses the position that is established by the last call, the call for the E segment, to satisfy the unqualified call.

  2. After you successfully retrieve a segment with an unqualified GN or GNP, IMS establishes position in only one hierarchic path: the path containing the segment just retrieved. IMS cancels positions in other hierarchic paths. IMS establishes current position on the segment that is retrieved and sets parentage on the parent of the segment that is retrieved. If you issue a qualified call for a segment in a different hierarchic path after issuing an unqualified call, the results are unpredictable. For example:
    Your program issues these calls: DL/I returns these segments:
    GU A (where AKEY = A1) A1
    GN B B11
    GN E E11
    GN F111
    GN B unpredictable

    When you issue the unqualified GN call, IMS no longer maintains a position in the other hierarchic path, so the results of the GN call for the B segment are unpredictable.

  3. If you issue an unqualified GN or GNP call and IMS has a position established on a segment that the unqualified call might encounter, the results of the call are unpredictable. Also, when you issue an unqualified call and you have established position on the segment that the call should retrieve, the results are unpredictable.
    For example:
    Your program issues these calls: DL/I returns these segments:
    GU A (where AKEY = A1) A1
    GN E E11
    GN D D111
    GN B B12
    GN B B13
    GN E11 (The only position IMS has is the one established by the GN call.)

    In this example, IMS has a position established on E11. An unqualified GN call moves forward from the position that is established by the previous call. Multiple positions are lost; the only position IMS has is the position that is established by the GN call.

To summarize these rules:
  1. To satisfy an unqualified GN or GNP call, IMS uses the position established in the last call for that PCB.
  2. If an unqualified GN or GNP call is successful, IMS cancels positions in all other hierarchic paths. Position is maintained only within the path of the segment retrieved.

Resetting position with multiple positioning

To reset position, your program issues a GU call for a root segment. If you want to reset position in the database record you are currently processing, you can issue a GU call for that root segment, but the GU call cannot be a path call.

Example: Suppose you have positions established on segments B11 and E11. Your program can issue one of the calls below to reset position on the next database record.

Issuing this call causes IMS to cancel all positions in database record A1:
GU   AbbbbbbbAKEYbbbb=bA2)
Or, if you wanted to continue processing segments in record A1, you issue this call to cancel all positions in record A1:
GU    AbbbbbbbAKEYbbbb=bA1)
Issuing this call as a path call does not cancel position.