Module 6: Procedure Division
COBOL DIVIDE verb
- DIVIDE verb is used to divide one numeric value by another numeric value and store the calculated value
- Basic syntax:-
Format 1:-
DIVIDE {identifier-1/literal-1}
INTO identifier-2 [, identifier-3]…
Format 2:-
DIVIDE {identifier-1/literal-1}
INTO {identifier-2/literal-2} [, {identifier-3/literal-3}]…
GIVING identifier-4 [, identifier-5]…
[REMAINDER identifier-6.]
Format 3:-
DIVIDE {identifier-1/literal-1}
BY {identifier-2/literal-2}
GIVING identifier-3 [, identifier-4]…
[REMAINDER identifier-5.]
- Below table will help you understand few possible operations using DIVIDE
- When GIVING option is used, then only we can use numeric-literal in place of identifier-2, identifier-3
- Last named operand must never be literal as the resultant value is always stored there.