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 ]
  1. dim, dim1, dim2 and dim3 can be integer literals or constants. The upper limit is 65535.
  2. type-specification can be one of:
  3. 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
  1. rank an be an integer literal of 1, 2, or 3, to define a one-, two-, or three-dimentional dynamic array. Default is 1.
  2. type-specification can be one of:
  3. 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
  1. 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.