skip to main content

Procedure Division : Execution : State of a method, object, or program : Initial and last-used states of data

Initial and last-used states of data
When a method or program is activated, the data within is in either the initial state or the last-used state:
 
Automatic data and initial data is placed in the initial state every time the method or program in which it is described is activated.
 
Static data is placed in the initial state:
i.
ii.
iii.
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 method or program is placed in the initial state, the following occurs:
i.
ii.
iii.
iv.
For each dynamic-capacity table, except where the table is defined by an elementary entry with a VALUE clause, the capacity of the table is set to the minimum capacity specified in the corresponding OCCURS clause. If the INITIALIZED keyword is present in the OCCURS clause, all the occurrences, if any, of the table are then initialized.
v.
The length of each any-length elementary item that is specified without a VALUE clause is set to zero, before data is placed in the initial state.
 
Static and external data are the only data that are in the last-used state. External data is always in the last-used state except when the run unit is activated. Static data is in the last-used state except when it is in the initial state as defined above.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left