Action Statement
Increase or decrease an array's range of subscripts.
resize array ARRAY_NAME to DIMENSION
ARRAY_NAME
The identifier for the array.
to DIMENSION
An integer value representing the new size of the array.
Description
If the resize statement enlarges the array, data is not disturbed, and additional memory is added. If the resize statement decreases the array, some array space will be dropped and the data stored there will be lost.
The following table shows array sizes. If there is not enough memory when enlarging the array with the resize statement, use squeeze memory to create the additional needed space.
Array Type Bytes Used
integer (number of array elements * 4) + 6 + (number of dimensions * 4)
float (number of array elements * 8) + 6 + (number of dimensions * 4)
string (number of array elements * 4) + 6 + (number of dimensions * 4) + length of all strings
boolean ((number of array elements + 7) / 8) + 6 + (number of dimensions * 4)
structure (number of array elements * size of structure) + 6 +
(number of dimensions * 4)
You cannot resize an array that is within a structure variable or a field within a structure.
Arrays are resizable in the first dimension only.
Note that when a change to program is done, a resized global array of structures defaults to its originally defined size.
Example
integer variable ObjectLimit is 10
# array size is 30 strings:
string ObjectChildren[1 thru ObjectLimit,3]
action RedimensionArray is
# following statement makes array size
# 15 elements larger:
resize array ObjectChildren to (5+ObjectLimit)
copy (5+ObjectLimit) to ObjectLimit
copy "LastObject" to ObjectChildren[ObjectLimit,3]
#ObjectChildren[15,3] now equals "LastObject"
See Also
Array Definition and Reference
squeeze memory Action Statement
structure Variable Declaration
structure is Type Definition