{qualifier} DIMX arrayname(expr1,...,exprn),type{,sizeexpr {,AUTO_EXTEND}}
{qualifier} DIMX arrayname(expr1,...,exprn),structname {,AUTO_EXTEND}
DIMX declares an array whose element size and extent may be determined at run time. The size of the array can be changed explicitly after the initial DIMX using REDIMX or, with the AUTO_EXTEND keyword, it can be extended automatically.
Arguments
qualifier
An optional keyword to qualify the scope and longevity of the array. Valid qualifiers are STATIC, PRIVATE and PUBLIC. (See MAP Statement Extensions)
expr1,...,exprn
One or more expressions (literal values, variables or arithmetic expressions) evaluated when the statement is encountered at runtime. The number of expressions given determines the number of dimensions of the resulting array.
type
standard variable types (F, B, X, S, I)
sizeexpr
Arithmetic expression (evaluated at runtime) for the size of each element in the array
structname
Name of a structure previously defined with DEFSTRUCT. See Defined Structures and Dynamic Array of Structures.
AUTO_EXTEND
This keyword (case insensitive) causes the array to be automatically extended as required by direct Assignment Statements. See notes below for more details.
IMX FDATA(COUNT),F STATIC DIMX SDATA(COUNT1,A*B,C),S,len(S2$) PRIVATE DIMX CUSARY(0),ST_CUS,AUTO_EXTEND The first DIMX statement above represents a simple example of allocating a single-dimensioned array of COUNT (evaluated at runtime) items, each of them a floating point value (using the default floating point size). This is similar to the original DIM statement. The second statement declares a three-dimension array of string elements whose size matches the logical length of the string S2$ (evaluated at the time the DIMX statement is encountered). The STATIC qualifier would make sense only within the context of a function or procedure; see MAP Statement Extensions for further notes. The third statement declares an auto-extending array of ST_CUS DEFSTRUCT. The initial size of this array is 0 elements, but will grow automatically as assignments are made to it; see comments about AUTO_EXTEND in the notes below. The PRIVATE keyword would limit access to the array to routines within the same ++INCLUDE file. In order for that to make any sense, the statement would have to appear at the top of the ++INCLUDE file, above any functions and procedures. Furthermore, the ++INCLUDE file would need to be positioned at the top of the main program, or otherwise in arranged so that the run time flow of execution encountered the DIMX statement before it encountered any other references to it. |
|
See Also
Subtopics
•