Static arrays

Static arrays can store a one-, two- or three-dimensional array of variables, all of the same type. An array member can be any type except another array (ARRAY ... OF ARRAY).

MAIN
  DEFINE custlist ARRAY[100] OF RECORD
             id INTEGER,
             name VARCHAR(50)
         END RECORD
  LET custlist[50].id = 12456
  LET custlist[50].name = "Beerlington"
END MAIN

The multi-dimensional array syntax (ARRAY[i[,j[,k]]]) specifies static arrays defined with an explicit size for all dimensions. Static arrays have a size limit. The biggest static array size you can define is 65535.

A single array element can be referenced by specifying its coordinates in each dimension of the array.

Avoid using large static arrays; All elements of static arrays are allocated and initialized when the program starts, even if the array is not used.
MAIN
  DEFINE a1 ARRAY[100] OF INTEGER
  LET a1[50] = 12456
  LET a1[5000] = 12456  -- Runtime error!
END MAIN
The elements of a static array variable can be of any data type except an array definition, but an element can be a record that contains an array member.
MAIN
  DEFINE arr ARRAY[50] OF RECORD
               key INTEGER,
               name CHAR(10),
               address VARCHAR(200),
               contacts ARRAY[50] OF VARCHAR(20)
       END RECORD
  LET arr[1].key = 12456
  LET arr[1].name = "Scott"
  LET arr[1].contacts[1] = "Bryan COX"
  LET arr[1].contacts[2] = "Mike FLOWER"
END MAIN

Static arrays are passed by value to functions. This is not recommended as all array members will be copied on the stack. A static array cannot be returned from a function.

Array methods can be used on static arrays; However these methods are designed for dynamic arrays and are not appropriate for static arrays. See array method description for more details.