Built-in function %SUBARR returns a section of the specified array
starting at start-index. The number of elements
returned is specified by the optional number-of-elements parameter.
If not specified, the number-of-elements defaults
to the remainder of the array.
The first parameter of %SUBARR must be an array. That is, a standalone
field, data structure, or subfield defined as an array. The first
parameter must not be a table name or procedure call.
The start-index parameter must be a numeric
value with zero decimal positions. A float numeric value is not allowed.
The value must be greater than or equal to 1 and less than or equal
to the number of elements of the array.
The optional number-of-elements parameter
must be a numeric value with zero decimal positions. A float numeric
value is not allowed. The value must be greater than or equal to 1
and less than or equal to the number of elements remaining in the
array after applying the start-index value.
Generally, %SUBARR is valid in any expression where an unindexed
array is allowed. However, %SUBARR cannot be used in the following
places:
as the array argument of built-in function %LOOKUPxx
as a parameter passed by reference
%SUBARR may be used in the following ways:
On the left-hand side of an assignment using EVAL or EVALR. This
changes the specified elements in the specified array.
Within the expression on the right-hand side of an assignment
using EVAL or EVALR where the target of the assignment is an array.
This uses the values of the specified elements of the array. The array
elements are used directly; a temporary copy of the sub-array is not
made.
In Extended Factor 2 of the SORTA operation.
In Extended Factor 2 of the RETURN operation.
Passed by VALUE or by read-only reference (CONST keyword) when
the corresponding parameter is defined as an array.
It is valid to use %SUBARR to assign part of an array to
another part of the same array. However, if the source part of the
array overlaps the target part of the array, unpredictable results
can occur.