IF statement and boolean operators

You can combine two or more conditional expressions on the IF statement. ISPF evaluates the conditional expressions on the IF statement from left to right, starting with the first expression and proceeding to the next and subsequent expressions on the IF statement until processing is complete.

The use of the AND Boolean operator takes precedence over the OR Boolean operator as shown in these examples.

The number of conditional expressions you can specify on the IF statement is limited to 255.

The accepted symbols for the Boolean operators are:

Examples of Boolean operators in the IF statement

Because the IF statement AND Boolean operator has precedence over the IF statement OR Boolean operator, specifying an IF statement similar to the one shown might not give you the results you expected.

If you expected the previous statement to be evaluated like this:
  IF ( (expression1 OR expression2) AND expression3)
You would need to write either two separate IF statements:
IF (Expression-1 OR Expression-2)
  IF (Expression-3)
⋮
  Else
    .msg = nld126
Or two separate comparison pairs:
IF (Expression-1 AND Expression-3 OR
          Expression-2 AND Expression-3)
⋮
Else
  .msg = nld127