ADELIA |
VADELIA |
SADELIA |
WADELIA |
MADELIA |
(I/B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
(I) (C/S) |
Section for use
All
Syntax
TOTALIZE_ARRAY Array VarId H
Description
This instruction calculates the algebraic sum of all the elements of the array Array and places the result in the variable VarId.
The array must consist of numeric elements and be a one-dimensional array.
The variable must be numeric.
Rounding can be performed using "H", which uses standard AS/400 rounding rules (half adjustment). Rounding is performed after all additions have been performed.
Example
* |
Let's assume that ARR_VALUES array (3 elements) contains the following values: |
|
* |
001.0 001.7 –01.1 |
|
|
|
|
|
|
|
* |
a) if W_TOTAL is a 7-digit field with 1 decimal |
|
TOTALIZE_ARRAY ARR_VALUES W_TOTAL |
||
* |
W_TOTAL is equal to |
|
|
||
|
||
* |
b) if W_TOTAL is a 7-digit field with 0 decimal |
|
TOTALIZE_ARRAY ARR_VALUES W_TOTAL H |
||
* |
W_TOTAL is then equal to |