COMPUTE
Short Reference
Syntax Forms
Arithmetic Expression
1. [COMPUTE] result = arith_exp.
Bit Expression
2. [COMPUTE] result = bit_exp.
Effect
This statement assigns the result of an arithmetic
expression arith_exp to a variable
result. You can omit the keyword COMPUTE. The
data type of result must be either a numeric or a byte-like data object depending on the expression.
Note
In addition to the main variants, you can use the following variants:
-
[COMPUTE] result = dobj.
-
[COMPUTE] result ?= dobj.
These variants have
the same effect as MOVE dobj {TO|?TO} result. Therefore, they are assignments, not calculations. In particular, the
conversion rules apply to assignments.
-
[COMPUTE] destination1 = destination2 = ... = result = arith_exp|bit_exp|dobj.
In this variant, a value is assigned to the variable result
according to the COMPUTE assignment.
destination1, destination2, ... are filled according to the rules of a multiple assignment.