Specifying ALL as a subscript is equivalent to specifying all table elements possible using every valid subscript in that subscript position.
For a table argument specified as "Table-name(ALL)", the order of the implicit specification of each table element as an argument is from left to right, where the first (or leftmost) argument is "Table-name(1)" and ALL has been replaced by 1. The next argument is "Table-name(2)", where the subscript has been incremented by 1. This process continues, with the subscript being incremented by 1 to produce an implicit argument, until the ALL subscript has been incremented through its range of values.
FUNCTION MEAN(Table(ALL))
is equivalent to
FUNCTION MEAN(Table(1) Table(2) Table(3)... Table(n))
where n is the
number of elements in Table.If there are multiple ALL subscripts, "Table-name(ALL, ALL, ALL)", the first implicit argument is "Table-name(1, 1, 1)", where each ALL has been replaced by 1. The next argument is "Table-name(1, 1, 2)", where the rightmost subscript has been incremented by 1. The subscript represented by the rightmost ALL is incremented through its range of values to produce an implicit argument for each value.
Once a subscript specified as ALL has been incremented through its range of values, the next subscript to the left that is specified as ALL is incremented by 1. Each subscript specified as ALL to the right of the newly incremented subscript is set to 1 to produce an implicit argument. Once again, the subscript represented by the rightmost ALL is incremented through its range of values to produce an implicit argument for each value. This process is repeated until each subscript specified as ALL has been incremented through its range of values.
FUNCTION MEAN(Table(ALL, ALL))
is equivalent to
FUNCTION MEAN(Table(1, 1) Table(1, 2) Table(1, 3)... Table(1, n)
Table(2, 1) Table(2, 2) Table(2, 3)... Table(2, n)
Table(3, 1) Table(3, 2) Table(3, 3)... Table(3, n)
.
.
.
Table(m, 1) Table(m, 2) Table(m, 3)... Table(m, n))
where
n is the number of elements in the column dimension of Table, and m is the
number of elements in the row dimension of Table.ALL subscripts can be combined with literal, data-name, or index-name subscripts to reference multidimensional tables.
FUNCTION MEAN(Table(ALL, 2))
is equivalent to
FUNCTION MEAN(Table(1, 2)
Table(2, 2)
Table(3, 2)
.
.
.
Table(m, 2))
where m is the number of elements in the row
dimension of Table.If an ALL subscript is specified for an argument and the argument is reference modified, then the reference-modifier is applied to each of the implicitly specified elements of the table.
If an ALL subscript is specified for an operand that is reference-modified, the reference-modifier is applied to each of the implicitly specified elements of the table.
If the ALL subscript is associated with an OCCURS DEPENDING ON clause, the range of values is determined by the object of the OCCURS DEPENDING ON clause.
01 PAYROLL.
02 PAYROLL-WEEK PIC 99.
02 PAYROLL-HOURS PIC 999 OCCURS 1 TO 52
DEPENDING ON PAYROLL-WEEK.
The following COMPUTE statement could be used to identify the mean hours worked in any week:
COMPUTE YTD-HOURS = FUNCTION SUM (PAYROLL-HOURS(ALL))
COMPUTE MAX-HOURS = FUNCTION MAX (PAYROLL-HOURS(ALL))
COMPUTE MAX-WEEK = FUNCTION ORD-MAX (PAYROLL-DAYS(ALL))
In this function invocation the subscript ALL is used to reference all elements of the PAYROLL-HOURS array (depending on the execution time value of the PAYROLL-WEEK field).