Position after retrieval calls
After you issue any kind of successful retrieval call, position immediately follows the segment occurrence you just retrieved or the lowest segment occurrence in the path if you retrieved several segment occurrences using the D command code. When you use the D command code in a retrieval call, a successful call is one that IMS completely satisfies.
For example, if you issue the following call against the database shown in the previous figure,
IMS returns the C segment occurrence with the key of C111. Current position is immediately after
C111. If you then issue an unqualified
GN
call, IMS returns the C112 segment to your program. GU Abbbbbbb(AKEYbbbbEQA1)
Bbbbbbbb(BKEYbbbbEQB11)
Cbbbbbbb(CKEYbbbbEQC111)
Your current position is the same after retrieving segment C111, whether you retrieve it with
GU
, GN
, GNP
, or any of the Get Hold calls.
If you retrieve several segment occurrences by issuing a Get call with the D command code,
current position is immediately after the lowest segment occurrence that you retrieved. If you issue
the
GU
call as shown in the example above, but include the D command code in the
SSA for segments A and B, the current position is still immediately after segment C111. C111 is the
last segment that IMS retrieves for this call. With the D
command code, the call looks like this: GU Abbbbbbb(AKEYbbbbEQA1)
Bbbbbbbb(BKEYbbbbEQB11)
Cbbbbbbb*D(CKEYbbbbEQC111)
You do not need the D command code on the SSA for the C segment because IMS always returns to your I/O area the segment occurrence that is described in the last SSA.