Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Initial state for inter-program communication

The INITIAL attribute is created by specifying the INITIAL clause in the PROGRAM-ID paragraph of the program

(see "Initial clause").

Initial state means:

  • The program’s internal data defined in the WORKING-STORAGE SECTION or LOCAL-STORAGE SECTION is initialized. If the VALUE clause is specified for a data item, the item is set to the defined value. If no VALUE clause is specified, the initial value of the data item is undefined.

  • Files (contained files) belonging to the program are closed.

  • The control mechanisms for all the PERFORM statements contained in the program are set to their initial state.

  • A GO TO statement which refers to an ALTER statement in the same program is set to its initial state.

A program is in the initial state:

  1. when it is called for the first time in a run unit,

  2. when it is called for the first time since either it or a program in which it is directly or indirectly contained was the object of a CANCEL statement,

  3. whenever it is called if it has the INITIAL attribute,

  4. when it is contained directly or indirectly in a program that has the INITIAL attribute and when it called for the first time after this program has been called.

Example 12-4

Statement 1: Program B-PROG is in the initial state (rules 1 and 3).

Statement 2: Program B-PROG is in the initial state (rule 3).

Statement 3: Program C-PROG is in the initial state (rules 1 and 4).

Statement 4: Program D-PROG is in the initial state (rules 1 and 4)

Statement 5: Program C-PROG is not in the initial state.

Statement 6: Program C-PROG is in the initial state (rule 2).