Initial State

Automatic data and initial data is placed in the initial state every time the function, method or program in which it is described is activated.

Static data is placed in the initial state:

  1. The first time the function, method or program in which it is described is activated in a run unit.
  2. The first time the program in which it is described is activated after the execution of an activating statement referencing a program that possesses the initial attribute and directly or indirectly contains the program.
  3. The first time the program in which it is described is activated after the execution of a CANCEL statement referencing the program or CANCEL statement referencing a program that directly or indirectly contains the program.

When data in a function, method or program is placed in the initial state, the following occurs:

  1. Internal data items in the Working-Storage Section

    ISO2002MFOS390  and Local-Storage Section

    that are subject to VALUE clauses are initialized as described in the section The VALUE Clause in the chapter Data Division - File and Data Description.

  2. Internal data items in the Working-Storage Section that are not subject to VALUE clauses and internal data items in the File Section are initialized in accordance with the setting of the DEFAULTBYTE Compiler directive.
  3. Internal data items in the Linkage Section

    ISO2002MFOS390  and Local-Storage Section

    that are not subject to VALUE clauses and are undefined.

  4. MF Internal data items in the Thread-Local Section and the Object Section are treated in the same way as internal data items in the Working-Storage Section.
  5. The function, method or program's internal file connectors are initialized by setting them to not be in any open mode.
  6. The attributes of screen items are set as specified in the screen description entry.