COBOL/400 Language Help

Format 2 (ADD with GIVING)

Description
In Format 2, the values of the operands preceding the word GIVING are added together, and the sum is stored as the new value of each data item referenced by identifier-3.

The composite of operands in an arithmetic statement can have a maximum length of 30 digits. In Format 2, the composite of operands is determined by using all of the operands in a given statement excluding the data items that follow the word GIVING.

Format 2 (ADD with GIVING)
 
          *----------------*
          V                +
->->---ADD--*--identifier-1--*----*----*-----*--identifier-2--*----------->
          *--literal-1-----*    *-TO-*     *--literal-2-----*
 
          *---------------------------*
          V                           +
->--GIVING---identifier-3--*-----------*----------------------------------->
                          *--ROUNDED--*
 
->----*----------------------------------------------*------------------->
     *--*----*---SIZE ERROR imperative-statement-1--*
        *-ON-*
 
->---*---------------------------------------------------*--------------->
    *-NOT---*----*---SIZE ERROR imperative-statement-2--*
            *-ON-*
 
-> --*---------*---------------------------------------------------------><-
    *-END-ADD-*
 

identifier-1, -2, or -3

In Format 2, identifiers must name an elementary numeric item, except when following the word GIVING. Each identifier following the word GIVING must name an elementary numeric or numeric-edited item.

literal-1 or -2

Literal must be numeric.

GIVING

If you specify the GIVING phrase, all subsequent identifiers must name an elementary numeric or numeric-edited item. Any data items following the word GIVING are not included in the composite of operands.


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