Introduction | Language Structure | IB Statements | File System | Comet 32 Runtime | Index |
While there is no theoretical limit to the number of dimensions in an array, an array may contain a maximum of 32K bytes.
The following example shows how to define a one-dimensional string variable named LIST$. This array contains 200 elements, each with a length of 20 bytes:
In the Prodecure Division, an array variable is referred to using a numeric constant or numeric variable as the array subscript. The first subscript is 1.
For example:
Note: When a variable subscript is used, Comet verifies that the calculated offset for the array element is within the total array space only. It does not check to see if the size of any particular dimension has been exceeded. If the calculated offset falls beyond the array space, Comet issues an exception 50 (ARRAY SUBSCRIPT OUT OF RANGE).
Next, we'll expand the LIST$ variable to a two-dimensional variable:
Here's a three-dimensional array named CHART$, with 10 x 5 x 8 dimensions, each element defined as a 15-byte string:
Finally, here's six-dimensional numeric array named DATA, with 4 x 4 x 4 x 4 x 4 x 4 dimensions, each element defined as length/precision of 2.0:
Note: While all of the above examples show LOCAL variables, they could also be defined as COMMON variables.