COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-56
DIVIDE GIVING REMAINDER
remainder
is the identifier of an elementary numeric or elementary numeric edited data item
where the remainder is stored.
imperative-stmt-1
is an imperative statement for the process to execute if it detects a size error in the
division or in storing the result.
imperative-stmt-2
is an imperative statement for the process to execute if it does not detect a size
error in the division or in storing the result.
END-DIVIDE
ends the scope of the DIVIDE statement and makes it a delimited-scope
statement. If you omit END-DIVIDE but include the SIZE ERROR or NOT SIZE
ERROR phrase, the DIVIDE statement is a conditional statement and ends at the
next period separator.
Usage Considerations:
•
Mathematics
The statement
DIVIDE A INTO B GIVING C REMAINDER D
means store the quotient portion of the value of B /A in C and store the remainder
in D.
The statement
DIVIDE A BY B GIVING C REMAINDER D
means store the quotient portion of the value of A /B in C, and store the remainder
in D.
•
Precision
For a discussion of the precision of HP COBOL division, see Arithmetic Precision.
•
Remainder
HP COBOL computes the remainder by performing the division with a signed
quotient having the same number of decimal places as the quotient. For example,
dividing 2 into -5 yields a remainder of -1. This differs from COBOL, in which the
intermediate value has the same sign as the quotient.