REXX Operators

CICS users

FORM.CALC, FORM.CONDITIONS, and Column Definition use expressions written in REXX,which QMF does not supoport in CICS.

Each operator (except the prefix operator) acts on two terms. These terms can be symbols, functions, or subexpressions in parentheses. Each prefix operator acts on the term or subexpression that follows it. The following operators are allowed in QMF expressions:

Arithmetic Operators

+
Add
-
Subtract
*
Multiply
/
Divide
%
Divide and return only the integer part of the quotient
//
Divide and return only the remainder (not modulo because the result can be negative)
**
Raise a number to a whole-number power (exponentiation)
Prefix -
Negate the following term
Prefix +
Take the following term as is

Comparative Operators

==
Exactly equal (identical)
=
Equal (numerically or when padded)
¬==, /==
Not exactly equal (inverse of ==)
¬=, /=
Not equal (inverse of =)
>
Greater than
<
Less than
< >
Not equal
>=
Greater than or equal
¬<
Not less than
<=
Less than or equal
¬>
Not greater than

Concatenation Operator

||
Concatenate terms (can use no blanks or one blank)

REXX provides other concatenation operators. See the TSO/E Procedures Language MVS/REXX Reference or the Virtual Machine/Enterprise Systems Architecture REXX/VM Reference for more information.

Logical (Boolean) Operators

&
AND (returns 1 if both terms are true)
|
Inclusive OR (returns 1 if either term is true)
&&
Exclusive OR (returns 1 if either term is true, but not both)
Prefix ¬
Logical NOT (negates; 1 becomes 0 and vice versa)

Operator Priorities

Expression evaluation is from left to right. Modify this by using parentheses and operator priority.

Use parentheses to clarify the meaning when the priority of operators is not obvious. An expression in parentheses is evaluated first.

When the sequence:

term1 operator1 term2 operator2 term3 ...

is encountered, and operator2 has a higher priority than operator1, the expression (term2 operator2 term3 ...) is evaluated first, applying the same rule repeatedly, as necessary.

For example, * (multiply) has a higher priority than + (add), so 3 +2*5 evaluates to 13, rather than 25, which results if strict left-to-right evaluation occurred.

The order of priority of the operators (from highest to lowest):

+ - ¬
Prefix operators
**
Exponentiation
* / % //
Multiply and divide
+ -
Add and subtract
||
Concatenation with or without blank
=, >, ...
All comparison operators
&
And
|, &&
Or, exclusive or

The & and && operators must be followed by a blank in calculation expressions to differentiate them from substitution variables.

For operators of equal priority (the multiply and divide operators, for example), the left-to-right rule prevails.

The only difference between these priorities and conventional algebra is that the prefix minus operator has a higher priority than the exponential operator. Thus -3**2 evaluates to 9, not -9.

[ Previous Page | Next Page | Contents | Index ]