Arithmetic Expressions

Arithmetic expressions are used in COBOL to represent a fixed or computed numeric value. An arithmetic expression can be one of the following:

  1. a numeric elementary data item
  2. a numeric literal
  3. the address of a data item (ADDRESS OF phrase)
  4. two or more of the above, separated by arithmetic operators
  5. two or more arithmetic expressions, separated by arithmetic operators
  6. an arithmetic expression enclosed in parentheses
  7. an arithmetic expression preceded by a unary operator (a sign)

Arithmetic expressions can use five binary and two unary arithmetic operators. A space must precede and follow each operator. The operators are:

Binary Operator Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
** Exponentiation
Unary Operator Meaning
+ Multiplication by +1
- Multiplication by -1
Note: Spaces are often required before and after minus signs to prevent ambiguity.