COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

ROUNDED
specifies that result is to be rounded before being stored.
imperative-stmt-1
is an imperative statement to be executed if a size error occurs during the addition of addends
or the storing of a result.
imperative-stmt-2
is an imperative statement to be executed if no size error occurs during the addition of addends
or the storing of a result.
END-ADD
ends the scope of the ADD statement and makes it a delimited-scope statement. If you omit
END-ADD but include the SIZE ERROR or NOT SIZE ERROR phrase, the ADD statement is a
conditional statement and ends at the next period separator.
Usage Considerations:
Specifying the Same Data Item for More Than One Result
For each result, the sum of the addends is added to the current value of result, and that
new sum becomes the new value of result (after rounding if rounding was specified). If
more than one result specifies the same data item, the final value of that item reflects
multiple additions of the intermediate sum. For example, if the initial value of A is 2, then the
statement
ADD 5 TO A A A
changes the value of A to 7, and then 12, and finally 19.
Operand Identification Order
For each result, operand identification occurs just prior to the add-and-store operation;
therefore, in the statement
ADD A B C TO I I X(I)
the subscript is not evaluated until A+B+C is added to I twice.
Arithmetic Operations
See Arithmetic Operations (page 257) for information on data conversion and alignment,
intermediate results, multiple results (and subscript evaluation), and incompatible data.
Precision
See ADD and SUBTRACT Statements (page 262) for information on precision of addition.
ROUNDED, SIZE ERROR, and NOT SIZE ERROR Phrases
See ROUNDED Phrase (page 244) and SIZE ERROR Phrase (page 244) for information on these
phrases.
ADD GIVING
ADD GIVING adds two or more numeric values and replaces the current value of one or more
result data items with that sum; for example,
ADD A B C GIVING D E
stores A+B+C in both D and E.
ADD 285