Position after ISRT

After you add a new segment occurrence to the database, current position immediately follows the new segment occurrence.

For example, in the following figure, if you issue the following call to add segment C113 to the database, current position immediately follows segment C113. An unqualified GN call would retrieve segment D111.
ISRT   Abbbbbbb(AKEYbbbb=bA1)
       Bbbbbbbb(BKEYbbbb=bB11)
       Cbbbbbbb

If you are inserting a segment that has a unique key, IMS places the new segment in key sequence. If you are inserting a segment that has either a non-unique key or no key at all, IMS places the segment according to the rules parameter of the SEGM statement of the DBD for the database. the topic "ISRT Call" in IMS Version 15.3 Application Programming APIs explains these rules.

If you insert several segment occurrences using the D command code, current position immediately follows the lowest segment occurrence that is inserted.

For example, suppose you insert a new segment B (this would be B14), and a new C segment occurrence (C141), which is a dependent of B14. The following figure shows what the hierarchy looks like after these segment occurrences are inserted. The call to do this looks like this:
ISRT   Abbbbbbb(AKEYbbbb=bA1)
       Bbbbbbbb
*D
       Cbbbbbbbb

You do not need the D command code in the SSA for the C segment. On ISRT calls, you must include the D command code in the SSA for the only first segment you are inserting. After you issue this call, position immediately follows the C segment occurrence with the key of C141. Then, if you issue an unqualified GN call, IMS returns segment E11.

If your program receives an II status code as a result of an ISRT call (which means that the segment you tried to insert already exists in the database), current position is just before the duplicate of the segment that you tried to insert.

Figure 1. Hierarchy after adding new segments and dependents 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