Position after DLET

After a successful DLET call, position immediately follows the segment occurrence you deleted. This is true when you delete a segment occurrence with or without dependents.

For example, if you issue the call shown in the following code example to delete segment C111, current position is immediately after segment C111. Then, if you issue an unqualified GN call, IMS returns segment C112.
GHU   Abbbbbbb(AKEYbbbb=bA1)
      Bbbbbbbb(BKEYbbbb=bB11)
      Cbbbbbbb(CKEYbbbb=bC111)
DLET

The following figure shows what the hierarchy looks like after this call. The successful DLET call has deleted segment C111.

Figure 1. Hierarchy after deleting a segment
Hierarchical relationship between segment types. Segment A is parent of segments B and E. Segment B is parent of segments C and D. Segment E is parent of segment F

When you issue a successful DLET call for a segment occurrence that has dependents, IMS deletes the dependents, and the segment occurrence. Current position still immediately follows the segment occurrence you deleted. An unqualified GN call returns the segment occurrence that followed the segment you deleted.

For example, if you delete segment B11 in the hierarchy shown in the previous figure, IMS deletes its dependent segments, C112 and D111, as well. Current position immediately follows segment B11, just before segment B12. If you then issue an unqualified GN call, IMS returns segment B12. The following figure shows what the hierarchy looks like after you issued this call.

Figure 2. Hierarchy after deleting a segment and dependents
Hierarchical relationship between segment types. Segment A is parent of segments B and E. Segments C and D have been deleted. Segment E is parent of segment F

Because IMS deletes the segment's dependents, you can think of current position immediately following the last (lowest, right-most) dependent. In the example in the first figure, this immediately follows segment D111. But if you then issue an unqualified GN call, IMS still returns segment B12. You can think of position in either place—the results are the same either way. An exception to this can occur for a DLET that follows a GU path call, which returned a GE status code.