The ADD Statement

The ADD statement causes two or more numeric operands to be summed and the result to be stored.

General Formats for Format 1


General Formats for Format 2


General Formats for Format 3


Syntax Rules for All Formats

  1. In Formats 1 and 2, each identifier must refer to an elementary numeric item, except that in Format 2 each identifier following the word GIVING must refer to either an elementary numeric item or an elementary numeric edited item. In Format 3, each identifier must refer to a group item.
  2. Each literal must be a numeric literal.
  3. The composite of operands is determined as follows (see the topic Arithmetic Statements in the chapter Procedure Division):
    1. In Format 1, by using all of the operands in a given statement.
    2. In Format 2, by using all of the operands in a given statement excluding the data items that follow the word GIVING.
    3. In Format 3, separately for each corresponding pair of data items.
  4. In Format 3, CORR is an abbreviation for CORRESPONDING.
  5. OSVSVSC2MF Floating-point literals and floating-point data items can be used anywhere a numeric data item or literal can be specified.

General Rules for All Formats

  1. See the topics The ROUNDED Phrase, The ON SIZE ERROR Phrase, The CORRESPONDING Phrase, Arithmetic Statements, Overlapping Operands and Multiple Results in Arithmetic Statements in the chapter Procedure Division; the section Explicit and Implicit Scope Terminators in the chapter Concepts of the COBOL Language, and the section Delimited Scope Statements in the chapter Language Fundamentals.
  2. If Format 1 is used, the values of the operands preceding the word TO are added together, then this sum is added to the current value of identifier-2 storing the result immediately into identifier-2, and repeating this process respectively for each successive operand following the word TO in left-to-right order.
  3. If Format 2 is used, the value of the operands preceding the word GIVING are added together, then the sum is stored as the new value of each data item referenced by identifier-3, the resultant identifier.
  4. If Format 3 is used, data items in identifier-1 are added to and stored in corresponding data items in identifier-2.
  5. MF Your COBOL system ensures that enough places are carried so as not to lose any significant digits during execution.