Loading...
Select Version
The SUM function returns a value that is the sum of all the arguments.
The type of this function depends upon the argument types as follows:
Argument type | Function type |
all arguments integer | integer |
Format
FUNCTION
SUM
({argument-1}...)
Argument
argument-1 must be class "numeric".
Returned values
The returned value is the sum of all the arguments.
The error default value is 0.
See also: MAX, MIN, RANGE, MEAN, MEDIAN, MIDRANGE
Example 9-44
... DATA DIVISION. WORKING-STORAGE SECTION. 01 RES PIC 9(3). PROCEDURE DIVISION. P1 SECTION. MAIN. COMPUTE RES = FUNCTION SUM (12 32 5 8 17 9). DISPLAY RES UPON T. STOP RUN.
Result: 00000083