cobol DIVIDE statement DIVIDE statement formats


Example

DIVIDE a INTO b c d

Data item b, c, and d are changed as b/a, c/a and d/a.

DIVIDE a INTO b GIVING c

Data item c is changed as b/a.

DIVIDE a BY b GIVING c

Data item c is changed as a/b.

DIVIDE a INTO b GIVING q REMAINDER r

Data items q and r are set with results of b/a

DIVIDE a BY b GIVING q REMAINDER r

Data items q and r are set with results of b/a

All DIVIDE result fields may have ROUNDED MODE IS clauses.

All DIVIDE statements may have ON SIZE ERROR and NOT ON SIZE ERROR declarative statements included to catch invalid results given the type and size of the result fields.