Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)
Procedure Division
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual—426750-001
6-16
ADD Statements
ADD Statements
The ADD statements sum numeric values and store the results in one or more data
items. When defining a field to hold a total, the size of the field should be considered.
The receiving field must be large enough to hold the result and thus avoid truncation of
nonzero digits. The forms of the ADD statements are:
ADD TO
ADD GIVING
ADD CORRESPONDING
Each form is described in the following paragraphs.
ADD TO Statement
The ADD TO statement adds together all values specified and then adds that sum to the
current value in each data item specified.
value
is either a numeric literal or the identifier of an elementary numeric data item.
result
is the identifier of a numeric data item to which value, or the sum of the values, is
added.
ADD GIVING Statement
The ADD GIVING statement adds together all values specified and then replaces the
current value of each data item specified with the sum.
value
is either a numeric literal or the identifier of an elementary numeric data item.
result
is the identifier of a numeric data item into which the sum of the values is stored.
ADD CORRESPONDING Statement
The ADD CORRESPONDING statement adds together elementary items in one group
to any corresponding items in another group and then stores the totals in the second
group used for the addition. Items correspond when they have the same names and
ADD { value } ,... TO { result } ,...
ADD { value } ,... GIVING { result } ,...