INITIAL Clause
Specifies that when program-name is called, program-name and any programs contained within it are set to their initial state. (All working storage items are reset to their initial values and all INTERNAL files are closed.)
A program is set to its initial state:
- The first time the program is called in a run unit
- Every time the program is called, if it possesses the INITIAL attribute
- The first time the program is called after the execution of a CANCEL statement referencing the program or a CANCEL statement referencing a program that directly or indirectly contains the program
- The first time the program is called after the execution of a CALL statement
referencing a program that possesses the INITIAL attribute, and that directly
or indirectly contains the program.
For example, if program A calls program B, and program B has the INITIAL attribute and also contains program C, program C will be set to its initial state the first time that it is called after A called B.
When a program is set to its initial state, the following occur:
- The program's internal data contained in the Working-Storage and Local-Storage sections are initialized. If a VALUE clause is used in the description of the data item, the data item is initialized to the defined value. If a VALUE clause is not associated with a data item, the initial value of the data item depends on whether the *STDINZ, *STDINZHEX00 or the *NOSTDINZ option is specified on the CRTCBLMOD or CRTBNDCBL command.
- Files with internal file connectors associated with the program are not in the open mode.
- The control mechanisms for all PERFORM statements contained in the program are set to their initial states.
- The altered GO TO statements contained in the program are set to their initial state.