DIVIDE
Basic form
DIVIDE n1 BY n2.
Effect
Divides the contents of
n1 by n2 and
places the result in n1.
The equivalent is: n1 = n1 / n2.
Example
DATA: SUM TYPE P, NUMBER TYPE P.
DIVIDE SUM BY NUMBER.
Note
The specified details on conversions and performance for
COMPUTE apply in the same way to DIVIDE. Also: division by 0 is not allowed. Exception: 0 / 0 gives 0.
Catchable Exceptions
CX_SY_ARITHMETIC_OVERFLOW
-
Cause: Integer overflow during division
Runtime Error: COMPUTE_INT_DIV_OVERFLOW (catchable)
CX_SY_CONVERSION_OVERFLOW
-
Cause: Overflow during arithmetic operation (type P,
with specified length)
Runtime Error: BCD_FIELD_OVERFLOW (catchable)
CX_SY_ARITHMETIC_OVERFLOW
-
Cause: Overflow during arithmetic operation (type P)
Runtime Error: BCD_OVERFLOW (catchable)
CX_SY_ZERODIVIDE
-
Cause: Division by 0 (type P)
Runtime Error: BCD_ZERODIVIDE (catchable)
-
Cause: Division by 0 (type F)
Runtime Error: COMPUTE_FLOAT_ZERODIVIDE (catchable)
-
Cause: Division by 0 (type I)
Runtime Error: COMPUTE_INT_ZERODIVIDE (catchable)
Non-Catchable Exceptions
-
Cause: P field
does not contain correct BCD format
Runtime Error: BCD_BADDATA
Related
COMPUTE, DIVIDE-CORRESPONDING
Additional help
Arithmetic Calculations