Previous Topic Next topic Print topic


DIMENSION

Abbreviation: DIM

DIMENSION is an attribute that specifies that a declared name is an array and defines the number and extent of its dimensions. Its format is:

DIMENSION(b1[,b2]…)

Each b represents one bound pair, which specifies the number of elements in a single dimension of the array. Each bound pair specifies an optional lower bound (lb) and a requisite upper bound (hb) for that dimension. A bound pair can be specified as follows.

* The asterisk format of a bound pair, when used to define a parameter for a procedure or function, specifies that both the upper and lower bound of this dimension are to be taken from the corresponding array argument. If one bound pair is specified as asterisks, all bound pairs must be specified as asterisks.
lb:hb     This format specifies the minimum and maximum subscripts that can be used for the dimension. lb is an extent expression or optionally signed integer constant, depending on the storage class of the array, which specifies the lower bound of the dimension. Like lb, hb is either an extent expression or an optionally signed integer constant, depending on the storage class. It specifies the upper bound of the dimension.
hb This format specifies only the upper bound of the dimension. The lower bound is assumed to be 1.

For example:

DECLARE X(5) FLOAT;
DECLARE Y DIMENSION(5) FLOAT;

In this example, both X and Y are arrays of five floating-point values.

The DIMENSION attribute is normally written immediately after the variable's name and is written without the DIMENSION keyword.

When specified with the FILE or ENTRY attributes, DIMENSION causes the associated name to become a variable rather than a named constant.

Previous Topic Next topic Print topic