COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-11
ADD TO
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 for information on data conversion and alignment,
intermediate results, multiple results (and subscript evaluation), and incompatible
data.
Precision
See ADD and SUBTRACT Statements for information on precision of addition.
ROUNDED, SIZE ERROR, and NOT SIZE ERROR Phrases
See ROUNDED Phrase and SIZE ERROR Phrase for information on these
phrases.