Expressions
Most REXX instructions permit the use of expressions,
following normal algebraic style. Expressions can consists
of strings, symbols, or functions calls. Expressions are
evaluated from left to right, modified by parentheses and
the priority of the operators (as ordered below). Parentheses
may be used to change the order of evaluation.
All operations (except prefix operations) act on two items
and result in a character string.
Prefix + - ^
Prefix operations: Plus; Minus; and Not. (For + and -,
the item must evaluate to a number; for ^, the item
must evaluate to "1" or "0".)
ie. -4 /* -4 */
**
Exponentiate. (Both items must evaluate to numbers,
and the right-hand item must be a whole number.)
ie. 2 ** 3 /* 8 */
2 ** -3 /* 0.125 */
* / % //
Multiply; Divide; Integer Divide; Divide and return the
remainder. (Both items must evaluate to numbers.)
ie. 4 * 3 /* 12 */
4 / 3 /* 1.333.. */
5 % 3 /* 1 */
5 // 3 /* 2 */
+ -
Add; Subtract. (Both items must evaluate to numbers.)
ie. 2 + 3.02 /* 5.02 */
(blank) ||
Concatenate: with or without a blank. Abuttal of items
causes direct concatenation.
ie. a = 'One'
a 'two' /* "One two" */
a || 'two' /* "Onetwo" */
= == ^= ^== /= /== >
< ^> ^< >= <= <> ><
Comparisons (arithmetic compare if both items evaluate
to a number.) The == operator checks for an exact
match.
ie. 'marmita' = ' marmita ' /* 1 */
'marmita' == ' marmita ' /* 0 */
'marmita' ^= ' marmita ' /* 0 */
'marmita' ^==' marmita ' /* 1 */
&
Logical And. (Both items must evaluate to "0" or "1".)
ie. 'A'='B' & 'C'='C' /* 0 */
| &&
Logical Or; Logical Exclusive Or. (Both items must
evaluate to "0" or "1".)
ie. 'A'='B' | 'C'='C' /* 1 */
'A'='B' && 'C'='C' /* 1 */
In CMS/REXX the results of arithmetic operations are
rounded according the setting to NUMERIC DIGITS (default is 9).
Here all arithmetic operations follow C arithmetics. For a
more detail description look at the INTERNAL.DOC