EXTENT function

This function returns the extent of an array field or variable as an INTEGER value. More specifically, it returns:

Note: The EXTENT function corresponds to the EXTENT attribute.

Syntax

EXTENT ( array )
array
Any array field or variable.

Example

In the following example, the EXTENT function is used to set the limit of a DO loop that cycles through all elements of an array:

r-arrext.p

DEFINE VARIABLE int_value AS INTEGER NO-UNDO EXTENT 3 INITIAL [1, 2, 3].
DEFINE VARIABLE ix        AS INTEGER NO-UNDO .
DEFINE VARIABLE tot       AS INTEGER NO-UNDO LABEL "The total is".

DO ix = 1 TO EXTENT(int_value):
  tot = tot + int_value[ix].
END.

DISPLAY tot.

See also

DEFINE VARIABLE statement, ENTRY function, EXTENT attribute, EXTENT statement