COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-266
SUBTRACT GIVING
minuend
is a numeric literal or the identifier of an elementary numeric data item.
result
is the identifier of a numeric or numeric edited elementary data item.
ROUNDED
specifies that the result is to be rounded before being stored.
imperative-stmt-1
is an imperative statement to be executed when a size error is detected in the
subtraction or in storing the result.
imperative-stmt-2
is an imperative statement to be executed when no size error is detected in the
subtraction or in storing the result.
END-SUBTRACT
ends the scope of the SUBTRACT statement, causing the SUBTRACT to be a
delimited-scope statement. If the SUBTRACT statement does not end with an
END-SUBTRACT phrase, the presence of the SIZE ERROR or the NOT SIZE
ERROR phrase causes the SUBTRACT statement to be a conditional statement,
which ends at the next period separator.
Usage Considerations:
Mathematics
The values of all the subtrahend s are totaled. That sum is subtracted from
minuend, and the result of this subtraction is then stored after rounding, if
ROUNDED was specified as the new value of each result. For example, the
statement
SUBTRACT A B C FROM D GIVING E
means store D - (A + B + C) in E.
Changing Operand Values
The SUBTRACT GIVING statement does not change the value of any subtrahend
or the minuend, unless one is also named as a result.
Arithmetic Operations
See Arithmetic Operations for information on data conversion and alignment,
intermediate results, multiple results (and subscript evaluation), and incompatible
data.