VMS Help  —  COBOL  PROCEDURE_DIVISION, ADD
  The ADD statement adds two or more numeric operands and stores the
  result.

1  –  1format TO

  The ADD statement adds two or more numeric operands and stores the
  result.

  Format 1 -

   ADD { num } ... TO { rsult [ ROUNDED ] } ...

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

      [ END-ADD ]

1.1  –  num

  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 GIVING

  The ADD statement adds two or more numeric operands and stores the
  result.

  Format 2 -

   ADD { num } ... TO { num } GIVING { rsult [ ROUNDED ] } ...

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

      [ END-ADD ]

2.1  –  num

  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 CORRESPONDING

  The ADD statement adds two or more numeric operands and stores the
  result.

  Format 3 -

   ADD { CORRESPONDING } grp-1 TO grp-2 [ ROUNDED ]
       { CORR          }

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

      [ END-ADD ]

3.1  –  grp

  is the identifier of a numeric group item.

3.2  –  stment

  is an imperative statement.
Close Help