ARRAY
An array defines a vector variable with a list of elements.
Syntax 1: Static array definition
ARRAY dim-spec [
attributes-list ]
OF type-specification
where dim-spec is:
Note: In the next(s) syntax diagram(s), the
[ ] { } |
symbols are part of the syntax.- For a one-dimensional static
array:
[ dim ]
- For two-dimentional static
array:
[ dim1, dim2 ]
- For a three-dimensional static
array:
[ dim1, dim2, dim3 ]
- dim, dim1, dim2 and dim3 can be integer literals or constants. The upper limit is 65535.
- type-specification can be one of:
- A primitive type
- A record definition
- An array definition
- A dictionary definition
- A function type definition
- The name of a user defined type
- The name of a built-in class
- The name of an imported extension class
- The name of an imported Java class
- attributes-list is a comma-separated list of name = value pairs or name attributes, and defines attributes for the array type.
Syntax 2: Dynamic array definition
DYNAMIC ARRAY [
attributes-list ]
[
WITH DIMENSION rank ]
OF type-specification
- rank an be an integer literal of 1, 2, or 3, to define a one-, two-, or three-dimentional dynamic array. Default is 1.
- type-specification can be one of:
- A primitive type
- A record definition
- An array definition
- A dictionary definition
- A function type definition
- The name of a user defined type
- The name of a built-in class
- The name of an imported extension class
- The name of an imported Java class
- attributes-list is a comma-separated list of name = value pairs or name attributes, and defines attributes for the array type.
Syntax 3: Java array definition
(in the next diagram, the square brackets are part of the syntax)
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.