DIVIDE statement.

The DIVIDE statement divides one numeric data item into others and sets the values of data items equal to the quotient and remainder.

Format 1.

          DIVIDE { identifier-1 } INTO { identifier-2 [ ROUNDED ] } ...
                 { literal-1    }

                [ [ ON ] SIZE ERROR imperative-statement-1 ]
                [ NOT [ ON ] SIZE ERROR imperative-statement-2 ]

                [ END-DIVIDE ]

Format 2.

          DIVIDE { identifier-1 } INTO { identifier-2 }
                 { literal-1    }      { literal-2    }

                  GIVING { identifier-3 [ ROUNDED ] } ...

                [ [ ON ] SIZE ERROR imperative-statement-1 ]
                [ NOT [ ON ] SIZE ERROR imperative-statement-2 ]

                [ END-DIVIDE ]

Format 3.

          DIVIDE { identifier-1 } BY { identifier-2 }
                 { literal-1    }    { literal-2    }

                  GIVING { identifier-3 [ ROUNDED ] } ...

                [ [ ON ] SIZE ERROR imperative-statement-1 ]
                [ NOT [ ON ] SIZE ERROR imperative-statement-2 ]

                [ END-DIVIDE ]

Format 4.

          DIVIDE { identifier-1 } INTO { identifier-2 }
                 { literal-1    }      { literal-2    }

                  GIVING { identifier-3 [ ROUNDED ] }

                  REMAINDER identifier-4

                [ [ ON ] SIZE ERROR imperative-statement-1 ]
                [ NOT [ ON ] SIZE ERROR imperative-statement-2 ]

                [ END-DIVIDE ]

Format 5.

          DIVIDE { identifier-1 } BY { identifier-2 }
                 { literal-1    }    { literal-2    }

                  GIVING { identifier-3 [ ROUNDED ] }

                  REMAINDER identifier-4

                [ [ ON ] SIZE ERROR imperative-statement-1 ]
                [ NOT [ ON ] SIZE ERROR imperative-statement-2 ]

                [ END-DIVIDE ]