ARRAY
An array defines a vector variable with a list of elements.
Syntax 1: Static array definition
ARRAY [ size [,size [,size] ] ] [ attributes-list ]
OF data-type
where attributes-list
is:
ATTRIBUTES ( attribute [ = "value" ] [,...] )
- size can be an integer literal or an integer constant. The upper limit is 65535.
- data-type can be a data type, a record definition, a user defined type, a built-in class, an imported package class, or a Java class.
- attribute is an attribute to extend the array definition with properties.
- value is the value for the array definition attribute, it is optional for boolean attributes.
Syntax 2: Dynamic array definition
DYNAMIC ARRAY [ attributes-list ] [ WITH DIMENSION rank ]
OF data-type
where attributes-list
is:
ATTRIBUTES ( attribute [ = "value" ] [,...] )
- rank an be an integer literal of 1, 2, or 3. Default is 1.
- data-type can be a data type, a record definition, a user defined type, a built-in class, an imported package class, or a Java class.
- attribute is an attribute to extend the array definition with properties.
- value is the value for the array definition attribute, it is optional for boolean attributes.
Syntax 3: Java array definition
ARRAY [ ] OF java-type
- java-type must be a Java class or a simple data type that has a corresponding
primitive type in Java, such as
INTEGER
(int),FLOAT
(double).
Usage
An array defines an ordered set of elements.
Array variables can invoke methods specific to the array types.
The type of the array elements can be of a simple type or structured records.
Consider using dynamic arrays instead of static arrays.
Java-style arrays will only be useful to interface with Java calls.
Static and dynamic arrays can be defined with the ATTRIBUTES()
clause, to
specify meta-data information for the variable. This feature is especially used when defining
variables for XML-based Web Services. For more details about XML attributes, see
Attributes to customize XML serialization.