COMPUTE Statement

The COMPUTE statement provides the ability to perform general arithmetic computations.

General Format

COMPUTE { result [ROUNDED] } ... { =     } arithmetic-expr
                                 { EQUAL }

   [ ON SIZE ERROR statement ]

   [ NOT ON SIZE ERROR statement ]

[ END-COMPUTE ]

Syntax Rules

  1. result is an elementary numeric or numeric-edited data item.
  2. arithmetic-expr is any arithmetic expression.
  3. statement is an imperative statement.

General Rules

  1. The arithmetic-expr is evaluated and assigned to each result variable.
  2. Additional information can be found in the help topics covering Arithmetic Operations, Multiple Receiving Fields, the ROUNDED Option, and the SIZE ERROR Option.