ILE COBOL Language Reference


SUM

The SUM function returns a value that is the sum of the arguments.

The function type depends on the argument types, as follows:

Argument Type Function Type
All arguments integer Integer
Numeric (some arguments can be integer) Numeric
Format
 
                    .------------.
                    V            |
>>-FUNCTION SUM--(----argument-1-+--)--------------------------><
 
 
argument-1
Must be class numeric.

The returned value is the sum of the arguments. If the argument-1 series are all integers, the value returned is an integer. If the argument-1 series are not all integers, a numeric value is returned.

The equivalent arithmetic expression is:

  1. For one occurrence of argument-1,

    (argument-1)

  2. For two occurrences of argument-1,

    (argument-11 + argument-12)

  3. For n occurrences of argument-1,

    (argument-11 + argument-12 + ... + argument-1n)

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]