# EVALR (Evaluate expression, right adjust)

Free-Form Syntax |
EVALR{(MR)} result = expression |

Code |
Factor 1 |
Extended Factor 2 |
||||
---|---|---|---|---|---|---|

EVALR (M/R) |
Assignment Statement |

The EVALR operation code evaluates an assignment statement of the
form `result=expression`

. The expression is evaluated and
the result is placed right-adjusted in the result. Therefore, the
result cannot be a literal or constant, but must be a fixed-length
character, graphic, or UCS-2 field name, array name, array element,
data structure, data structure subfield, or a string using the %SUBST
built-in function. The type of the expression must be the same as
the type of the result. The result will be right justified and padded
with blanks on the left, or truncated on the left as required.

If the result represents an unindexed array or an array specified as array(*), the value of the expression is assigned to each element of the result, according to the rules described in Specifying an Array in Calculations. Otherwise, the expression is evaluated once and the value is placed into each element of the array or sub-array.

See Expressions for general information on expressions. See Precision Rules for Numeric Operations for information on precision rules for numeric expressions. This is especially important if the expression contains any divide operations, or if the EVALR uses any of the operation extenders.