DIMX vs DIM

DIMX is an enhanced version of the venerable DIM statement used to allocate an array at runtime. The enhancements of DIMX over DIM are:

• It accepts optional type and size specifiers rather than being limited to F6 and string with size determined by STRSIZ.

• The element size is evaluated at runtime, whereas with DIM, it is evaluated at compile time.

• It allocates the memory needed out of the system memory pool, rather than from the user partition. Memory used by DIMX is automatically released when the program ends.

• If the AUTO_EXTEND option is specified, the first dimension (first subscript) of the array will be automatically extended as needed whenever an assignment is made to the array.

• The AUTO_EXTEND feature is only activated for explicit assignments like those shown above; it is not normally activated for ambiguous or implicit assignments, such as when array elements are passed as parameters.