VMS Help  —  COBOL  PROCEDURE_DIVISION, DIVIDE
  The DIVIDE statement divides one or more numeric data items by another.
  It stores the quotient and, for Formats 4 and 5, the remainder.

1  –  1format INTO

  The DIVIDE statement divides one or more numeric data items by another.
  It stores the quotient.

  Format 1 -

   DIVIDE srcnum INTO { rsult [ ROUNDED ] } ...

      [ ON SIZE ERROR stment ] [ NOT ON SIZE ERROR stment ]

      [ END-DIVIDE ]

1.1  –  srcnum

  is a numeric literal or the identifier of an elementary numeric item.

1.2  –  rsult

  is the identifier of an elementary numeric item.  It is the resultant
  identifier.

1.3  –  stment

  is an imperative statement.

2  –  2format INTO GIVING

  The DIVIDE statement divides one or more numeric data items by another.
  It stores the quotient.

  Format 2 -

   DIVIDE srcnum INTO srcnum GIVING { rsult [ ROUNDED ] } ...

      [ ON SIZE ERROR stment ] [ NOT ON SIZE ERROR stment ]

      [ END-DIVIDE ]

2.1  –  srcnum

  is a numeric literal or the identifier of an elementary numeric item.

2.2  –  rsult

  is the identifier of an elementary numeric item or an elementary
  numeric edited item.  It is the resultant identifier.

2.3  –  stment

  is an imperative statement.

3  –  3format BY GIVING

  The DIVIDE statement divides one or more numeric data items by another.
  It stores the quotient.

  Format 3 -

   DIVIDE srcnum BY srcnum GIVING { rsult [ ROUNDED ] } ...

      [ ON SIZE ERROR stment ] [ NOT ON SIZE ERROR stment ]

      [ END-DIVIDE ]

3.1  –  srcnum

  is a numeric literal or the identifier of an elementary numeric item.

3.2  –  rsult

  is the identifier of an elementary numeric item or an elementary
  numeric edited item.  It is the resultant identifier.

3.3  –  stment

  is an imperative statement.

4  –  4format INTO with REMAINDER

  The DIVIDE statement divides one or more numeric data items by another.
  It stores the quotient and remainder.

  Format 4 -

   DIVIDE srcnum INTO srcnum GIVING rsult [ ROUNDED ] REMAINDER remaind

      [ ON SIZE ERROR stment ] [ NOT ON SIZE ERROR stment ]

      [ END-DIVIDE ]

4.1  –  srcnum

  is a numeric literal or the identifier of an elementary numeric item.

4.2  –  rsult

  is the identifier of an elementary numeric item or an elementary
  numeric edited item.  It is the resultant identifier.

4.3  –  remaind

  is the identifier of an elementary numeric item or an elementary
  numeric edited item.

4.4  –  stment

  is an imperative statement.

5  –  5format BY with REMAINDER

  The DIVIDE statement divides one or more numeric data items by another.
  It stores the quotient and remainder.

  Format 5 -

   DIVIDE srcnum BY srcnum GIVING rsult [ ROUNDED ] REMAINDER remaind

      [ ON SIZE ERROR stment ] [ NOT ON SIZE ERROR stment ]

      [ END-DIVIDE ]

5.1  –  srcnum

  is a numeric literal or the identifier of an elementary numeric item.

5.2  –  rsult

  is the identifier of an elementary numeric item or an elementary
  numeric edited item.  It is the resultant identifier.

5.3  –  remaind

  is the identifier of an elementary numeric item or an elementary
  numeric edited item.

5.4  –  stment

  is an imperative statement.
Close Help