INITIAL

Abbreviation: INIT

INITIAL is a storage class attribute that specifies the initial value of a variable or member of a structure. The INITIAL attribute has two formats. The first specifies an initial constant, expression, or variable whose value is assigned to a variable when storage is allocated to it. The second format specifies that the CALL option invokes a procedure to perform initialization at allocation. The variable is initialized by assignment during the execution of the called routine, rather than by the routine being invoked as a function that returns a value to the point of invocation. The formats of the INITIAL attribute are:

Format 1:

INITIAL(item[,item]…)

where item is:

*|constant|variable|expression|iteration-spec 

where iteration-spec is:

(iteration-factor) iteration-item

where iteration-item is:

*|constant|variable|expression

where iteration-factor is:

*|expression

where constant is:

arithmetic-constant|bit-constant|character-constant|
entry-constant1 label-constant
Note: Open PL/I supports the ANSI PL/I Subset G specification for the INITIAL attribute, not the full mainframe PL/I specification.

In the context of item or iteration-item, asterisk ( * ) specifies that the element is to be left uninitialized.

In the context of iteration-factor, asterisk (* ) specifies that the entire array is to be initialized with the iteration-item.

For static variables, any value specified in an INITIAL attribute is assigned at the time the program is first loaded into memory for execution.

For automatic variables, which are allocated at each activation of the declaring block, any specified initial value is assigned at the time of each allocation.

For based and controlled variables, which are allocated at the execution of ALLOCATE statements, any specified initial value is assigned at the time of each allocation.

The INITIAL attribute may not be used with variables of storage classes other than those mentioned above.

Only constant values with no operations can be specified in the INITIAL attribute for static variables, with the following exceptions:

Format 2:

INITIAL CALL entry(arg[,arg]…)

The INITIAL call cannot be used to initialize static data.