EXTENT statement
- Last Updated: February 11, 2026
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
Sets the number of elements for an indeterminate array. An indeterminate
array must have the extent size set before elements can be assigned into it. An
indeterminate array can also be resized using the EXTENT statement. The
EXTENT statement cannot be used to set or modify the
size of a determinate array.
Syntax
|
- 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
ERRORand displaying error messages.
Note: Compound assignment operators (
+=, -=, *=, /=)
can be used with the EXTENT statement. For more
information, see += Addition assignment operator, -= Subtraction assignment operator, *= Multiplication assignment operator, and /= Division assignment operator.Example
The following example defines an indeterminate array variable. The size of
the array variable is set multiple times using the
EXTENT
statement:
|
The following example uses the
+= assignment operator to add 10 elements to an indeterminate
array:
|
Notes
- You can call the
EXTENTstatement to resize an indeterminate array. If expression is set to a value that is larger than the original array, the existing elements are preserved, and the additional elements are initialized to the default value for the datatype. If expression is set to a smaller value, the data is truncated (elements in the array beyond the new size are lost). - You can also use the
EXTENTstatement to set the size of an indeterminate array back to its initial state (with no size) by specifying the Unknown value (?) in expression. - If you call the
EXTENTstatement attempting to set the extent size of a determinate array variable or parameter, the AVM generates a compiler error.
See also
DEFINE PARAMETER statement, DEFINE VARIABLE statement, EXTENT attribute, EXTENT function, NO-ERROR option, Parameter definition syntax, VAR statement