IBM SC34-5764-01 Server User Manual


 
=>< (comparison operators)
== >> <<
\= ¬=
>< <>
\> ¬>
\< ¬<
\== ¬==
\>> ¬>>
\<< ¬<<
>= >>=
<= <<=
/= /==
& (and)
|&& (or, exclusive or)
Examples:
Suppose the symbol A is a variable whose value is 3, DAY is a variable whose value is Monday, and other
variables are uninitialized. Then:
A+5 -> '8'
A-4*2 -> '-5'
A/2 -> '1.5'
0.5**2 -> '0.25'
(A+1)>7 -> '0' /* that is, False */
' '='' -> '1' /* that is, True */
' '=='' -> '0' /* that is, False */
' '¬=='' -> '1' /* that is, True */
(A+1)*3=12 -> '1' /* that is, True */
'077'>'11' -> '1' /* that is, True */
'077' >> '11' -> '0' /* that is, False */
'abc' >> 'ab' -> '1' /* that is, True */
'abc' << 'abd' -> '1' /* that is, True */
'ab ' << 'abd' -> '1' /* that is, True */
Today is Day -> 'TODAY IS Monday'
'If it is' day -> 'If it is Monday'
Substr(Day,2,3) -> 'ond' /* Substr is a function */
'!'xxx'!' -> '!XXX!'
'000000' >> '0E0000' -> '1' /* that is, True */
Note: The last example would give a different answer if the > operator had been used rather than >>.
Because '0E0000' is a valid number in exponential notation, a numeric comparison is done; thus
'0E0000' and '000000' evaluate as equal. The REXX order of precedence usually causes no
difficulty because it is the same as in conventional algebra and other computer languages. There
are two differences from common notations:
v The prefix minus operator always has a higher priority than the power operator.
v Power operators (like other operators) are evaluated left-to-right.
For example:
-3**2 == 9 /* not -9 */
-(2+1)**2 == 9 /* not -9 */
2**2**3 == 64 /* not 256 */
REXX General Concepts
Chapter 12. REXX General Concepts 119