1. COMPUTE
The COMPUTE statement stores the result of an arithmetic expression in one or more data items. There is no restriction on the combination of arithmetic expressions (including addition, subtraction, multiplication, and division) specified in a COMPUTE statement.
The following items are specified in the statement.
-
identifier-1
-
identifier-1 must be an elementary numeric item, elementary numeric-edited item, or elementary floating-point item.
-
-
arithmetic-expression
-
Any arithmetic expression that includes addition, subtraction, multiplication, and division can be specified.
-
After the COMPUTE statement is executed, the result of the arithmetic expression is computed, and it is stored in a data item specified in identifier-1.
-
If an arithmetic expression consists of a single identifier, numeric function, or literal, the COMPUTE statement functions in the same way as moving the identifier, numeric function, or literal to identifer-1.
-
-
ROUNDED phrase
-
For information about the ROUNDED phrase, refer to ROUNDED Phrase.
-
-
SIZE ERROR phrase
-
For information about the SIZE ERROR phrase, refer to SIZE ERROR Phrase.
-
-
END-COMPUTE phrase
-
The END-COMPUTE phrase is specified to explicitly express the scope of the COMPUTE statement.
-