Fixes the extent (number of elements) for an unfixed indeterminate array
variable or parameter, or resizes a fixed indeterminate array variable or parameter. Once
the extent is fixed, you can use the indeterminate array as you would any determinate
array.
Syntax
EXTENT ( array ) = expression [ NO-ERROR ]
|
-
array
- An expression that results in an ABL array.
-
expression
- An INTEGER expression that evaluates to the extent value assigned to
the array variable or parameter. The extent value can be any number between
1 and 28000, inclusive.
- NO-ERROR
- The NO-ERROR option is used to
prevent the statement from raising ERROR and
displaying error messages.
Example
The
following example defines an unfixed indeterminate array variable
and fixes its dimension using the EXTENT statement:
DEFINE VARIABLE x AS INTEGER NO-UNDO EXTENT.
MESSAGE EXTENT(x). /* Function returns ? */
EXTENT(x) = 4. /* Statement fixes the extent to 4 */
MESSAGE EXTENT(x). /* Function returns 4 */
|
Notes
- You can call the EXTENT statement to resize a fixed indeterminate array.
If expression is set to a value that is larger than the
original array, the additional elements are initialized to the default value for the
datatype. If expression is set to a smaller value, the
data is truncated.
- You can also use the EXTENT statement to reset a fixed indeterminate
array (that was previously defined as an unfixed indeterminate array) to its previously
unfixed state by specifying the Unknown value (?) in
expression.
- If you call the EXTENT statement attempting to fix the extent of a
determinate array variable or parameter, the AVM generates a compiler error.