z/OS TSO/E REXX User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Comparison Operators

z/OS TSO/E REXX User's Guide
SA32-0982-00

Expressions that use comparison operators do not return a number value as do arithmetic expressions. Comparison expressions return either a true or false response in terms of 1 or 0 as follows:
1
True
0
False

Comparison operators can compare numbers or strings and ask questions, such as:
  • Are the terms equal?  (A = B)
  • Is the first term greater than the second?  (A > B)
  • Is the first term less than the second?  (A < B)
For example, if A = 4 and B = 3, then the results of the previous comparison questions are:
  • (A = B) Does 4 = 3?       0 (False)
  • (A > B) Is 4 > 3?         1 (True)
  • (A < B) Is 4 < 3?         0 (False)
The more commonly used comparison operators are as follows:
Operator
Meaning
==
Strictly Equal
=
Equal
\ ==
Not strictly equal
\ =
Not equal
>
Greater than
<
Less than
> <
Greater than or less than (same as not equal)
> =
Greater than or equal to
\ <
Not less than
< =
Less than or equal to
\ >
Not greater than
Note: The not character, "¬", is synonymous with the backslash ("\"). The two characters may be used interchangeably according to availability and personal preference. This book uses the backslash ("\") character.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014