An independent segment is defined as part of the object program which can overlay, and can be overlaid by either a fixed overlayable segment or another independent segment. An independent segment is in its initial state whenever control is transferred (either implicitly or explicitly) to that segment for the first time during the execution of a program. On subsequent transfers of control to the segment, an independent segment is also in its initial state when:
- control is transferred to that segment as a result of the implicit transfer of control between consecutive statements from a segment with a different segment-number
- control is transferred to that segment as the result of the implicit transfer of control between a SORT or MERGE statement, in a segment with a different segment-number, and an associated input or output procedure in that independent segment
- control is transferred explicitly to that segment from a segment with a different segment-number (with the exception noted in paragraph 2 below).
On subsequent transfer of control to the segment, an independent segment is in its last-used state when:
- control is transferred implicitly to that segment from a segment with a different segment-number (except as noted in paragraph 1).
- control is transferred explicitly to that segment as the result of the execution of an EXIT PROGRAM
or GOBACK
statement.