RPG/400 Help
An entire array or individual elements in an array can be specified in
calculation specifications. You can process individual elements like
fields. Remember, if an array element is to be used as a result field,
the array name with the comma and index cannot exceed 6 characters.
To specify an entire array, use only the array name, which can be used as
factor 1, factor 2, or the result field. The following operations can
be used with an array name: ADD, Z-ADD, SUB, Z-SUB, MULT, DIV, SQRT,
MOVE, MOVEL, MOVEA, MLLZO, MLHZO, MHLZO, MHHZO, DEBUG, XFOOT, LOKUP, SORTA,
PARM, DEFN, CLEAR, RESET, CHECK, CHEKR, and SCAN.
Several other operations can be used with an array element only but not
with the array name alone. These operations include but are not limited
to: BITON, BITOF, COMP, CABxx, TESTZ, TESTN, TESTB, MVR, DOUxx, DOWxx,
IFxx, SUBST, and CAT.
When specified with an array name without an index, certain operations are
repeated for each element in the array. These are ADD, Z-ADD, SUB,
Z-SUB, MULT, DIV, SQRT, MOVE, MOVEL, MLLZO, MLHZO, MHLZO and MHHZO. The
following rules apply to these operations when an array name without an index
is specified:
- When factors 1 and 2 and the result field are arrays with the same number
of elements, the operation uses the first element from every array, then the
second element from every array until all elements in the arrays are
processed. If the arrays do not have the same number of entries, the
operation ends when the last element of the array with the fewest elements has
been processed. When factor 1 is not specified for the ADD, SUB, MULT,
and DIV operations, factor 1 is assumed to be the same as the result
field.
- When one of the factors is a field, a literal, or a figurative constant
and the other factor and the result field are arrays, the operation is done
once for every element in the shorter array. The same field, literal,
or figurative constant is used in all of the operations.
- The result field must always be an array.
- If an operation code uses factor 2 only (for example, Z-ADD, Z-SUB, SQRT,
ADD, SUB, MULT, or DIV do not have factor 1 specified) and the result field is
an array, the operation is done once for every element in the array.
The same field or constant is used in all of the operations.
- Resulting indicators (positions 54 through 59) cannot be used because of
the number of operations being processed.
[ Top of Page | Previous Page | Next Page | Table of Contents ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.