EVALR is the right-adjusted counterpart of EVAL for character assignments.
The source expression is right-aligned within the target field: shorter
source values are left-padded with blanks, and source values longer than the
target have their leftmost characters truncated (the rightmost N
characters are kept). EVALR is character-only; numeric receivers are not
permitted.
DCL-S target CHAR(10);
EVALR target = '12'; // target = ' 12' (8 leading blanks)
EVALR target = 'ABCDEFGHIJKL'; // target = 'CDEFGHIJKL' (leftmost 'AB' lost)
A common pattern combines EVALR with %TRIMR to convert a left-justified
value into a right-justified one within the same width:
DCL-S code CHAR(10) INZ('CAT ');
EVALR code = %TRIMR(code); // code = ' CAT'