DIM Verb
Syntax
DIM dimitem{,dimitem...}{,ERR=lineref}
Description
For BBj-specific information, see the DIM Verb - BBj.
The DIM verb is used to allocate and reallocate arrays as well as create simple strings and string templates.
Parameter |
Description |
||||||||
---|---|---|---|---|---|---|---|---|---|
dimitem |
Dimension item; can be one of four formats:
|
||||||||
ERR=lineref |
Branch to be taken if an error occurs during execution. |
dimensions may be 1 to 3 subscript ranges, separated by commas. Each subscript range has the following format:
{int:} int
When dimensioning a string array, the optional parenthetic argument may be used to initialize each element exactly as with simple strings; otherwise, each element is initialized to null. For porting older Business BASIC programs to PRO/5, parentheses may be used instead of brackets for numeric arrays. PRO/5 converts the parentheses to brackets automatically.
The same array may be redimensioned any number of times in PRO/5. Unlike
older Business BASICs, PRO/5 will not completely remove an array if it
is dimensioned to zero, DIM A[0], because it is the same as DIM A[0:0].
A one-element array is mathematically significant, and A[0:0] is as valid
as A[6:6]. To remove an array, use the CLEAR verb.
PRO/5 evaluates the arguments for each item in a DIM statement before the items are dimensioned. In the statement DIM Z$(LEN(Z$)), the current length of Z$ is evaluated before the new Z$ is created.
Any size array may be dimensioned, but it must not exceed memory limits.
Note that matrix operations on numeric arrays are supported. See the LET Verb for more information on matrix operations.
Example
>DIM X[5,5,5]
0100 DIM A$(32000,$01$)
0200 DIM B$(9),X[2,3],A$(9,"A")
0300 DIM ARRAY$[10:20](10,"*")
0400 DIM REC$:TEMP$