The array-init-definition
option
is used in the
variable-definition
option
of DEFINE DATA LOCAL
,
DEFINE DATA
INDEPENDENT
, DEFINE
DATA CONTEXT
and DEFINE DATA OBJECT
.
The array-init-definition
option
has the following syntax:
ALL |
<character-s ...> | |||||||||||||||||
( |
,...3 |
) |
||||||||||||||||
< |
> |
This document covers the following topics:
With an array-init-definition
you define the initial/constant values for an array.
Note:
If, in the variable-definition
option, the keyword INIT
was used for the initialization, the value may be modified by any statement
that affects the content of a variable. If the keyword
CONST
was used for the
initialization, any attempt to change the value will be rejected by the
compiler.
See also Defining Fields in the Programming Guide, particularly the following sections:
For a redefined field, an
array-init-definition
is not
permitted.
Syntax Element | Description |
---|---|
ALL |
ALL Option:
All occurrences in all dimensions of the array are initialized with the same value. |
index |
Index Option:
Only the array occurrences specified by the
If you specify
|
V |
V Notation:
This notation is only relevant for multidimensional arrays if the occurrences of one dimension are to be initialized with different values.
|
constant |
Constant Value Option:
The constant (value) with which the array is to be initialized
( For further information, see User-Defined Constants in the Programming Guide. Note: |
system-variable |
System Variable Option:
The initial value for an array may also be the value of a Natural system variable. Note: |
Character/String Option:
As initial value, a variable can be filled, entirely or partially, with a specific single character or string of characters (only possible for variables of format A or U). FULL LENGTH Option:
With With LENGTH Option:
A Within one
|
In this example, the first 5 positions of each occurrence of the array
will be filled with NONON
.
DEFINE DATA LOCAL 1 #FIELD (A25/1:3) INIT ALL LENGTH 5 <'NO'> ... END-DEFINE
Numerous examples of assigning initial values to arrays are provided in Initial Values (and the RESET Statement) in the Programming Guide.