MPE/iX Commands Reference Manual (32650-90877)
Appendix B 657
Expression Evaluator Functions
Expression Evaluator Features
Strings
A “string‘ of characters must be surrounded with quotation marks (“ or ‘) in order to be
treated as a string. For example, a + 'a' is treated as the contents of the string variable
a concatenated to the string 'a' .
Evaluating a string that contains a string operator returns an error unless the string itself
is surrounded by quotation marks (“ or ‘). You may include quotation marks within a string
in this fashion: “a‘b“ is evaluated as a‘b, but a‘b by itself produces an error.
You may also use quote folding, for example, two adjacent quotes of the same type that
began the string. They are folded to one and the string is not terminated, for example:
setvar a "a quote is here""!"
This would put the string a quote is here"! into the string variable A.
Variables
Variables that are dereferenced by an ! are dereferenced to complete resolution or to the
limits of dereferencing (default is 30 levels). Variables may be used in expressions without
the !, of course. This is called implicit dereferencing, and these variables are dereferenced
to only one level.
For example, if variable A has a value of B, it is implicitly and explicitly dereferenced as B.
If this variable has a value of !B, implicit dereferencing yields !B. If you want A to be fully
dereferenced, you must use !A (explicit dereferencing) in the expression you want
evaluated.
Variables and Strings
Explicitly dereferenced variables should be placed within quotation marks if you want the
variable's value treated as a string. Doing this also eliminates problems that might arise if
the variable contains delimiters or operators. Refer to the discussion on "Strings" above.
For example:
SETVAR X 3
CALC “AB‘ + “!X‘
AB3
CALC “AB‘ + X
error
CALC “AB“ + “X‘
ABX
SETVAR Z “foo‘
CALC “AB‘ + Z
ABfoo
CALC “AB‘ + “!Z‘
ABfoo
CALC “AB‘ + !Z
error variable foo not found
SETVAR A “X‘+“Y‘