Previous Topic: ExpressionNext Topic: BREAK Control Statement


Condition

A condition is a group of expressions separated by comparison operators and logical operators. In other words, a condition compares two or more sets of expressions.

Syntax

expression-1 co expression-2 [lo expression-3 co expression-4 ...]

where:

expression-1, expression-2, and, optionally, expression-3 and expression-4 specify an expression whose value is compared. In addition, expression-2 and expression-4 can contain a list of expressions (for example, ('ABC','DEF',...)). Enclose the list of expressions in parentheses.

For date field comparisons, expression-2 and expression-4 can be a specific date, Julian date, relative day, or year. For a specific date, specify the full date with date separator characters within quotes. A Julian date is specified in the CYYDDD format. A relative day, specified as a negative number, is the number of days relative to the current date where -0 is the current day, -1 is yesterday, and so forth. Years are specified as a four-digit year.

For comparisons with the GEN, HGEN, and LGEN fields, expression-2 and expression-4 can be a specific or relative generation. A relative generation, specified as a negative number, is the number of generations relative to the current generation where -0 is the current backup generation number, -1 is the previous backup generation number, and so forth.

co is a comparison operator as follows:

EQ equal
= equal

NE not equal
^= not equal
=^ not equal
<> not equal
>< not equal

LT less than
< less than

GT greater than
> greater than

GE greater than or equal to
^< greater than or equal to (not less than)
<^ greater than or equal to (not less than)
>= greater than or equal to
=> greater than or equal to

LE less than or equal to
^> less than or equal to (not greater than)
>^ less than or equal to (not greater than)
<= less than or equal to
=< less than or equal to

LIKE less than
LE less than

The LIKE comparison operator can only be used for character fields. The expression to the right of the comparison operator (expression-2, expression-4, and so forth) specifies a filtering field. Three special filtering characters are provided as pattern matching characters. All other characters reference a match of that specific character.

The special filtering characters are as follows:

* Matches any string of characters

This character is a fuzzy match character which can reference any number of characters as well as no characters. For example, '*' matches everything, 'A*' matches data starting with A, '*A' matches data ending with A (“A”, “LA”, “FLORIDA”, and so forth), and '*A*' matches A anywhere in the data (“A”, “LA”, “OHARE”, “MAINE”, and so forth)

? Match any single character including a blank
¬ Match a single non blank character

lo is a logical operator as follows:

AND Conditions on both sides of the logical operator must be true
& Conditions on both sides of the logical operator must be true
OR Either condition surrounding the logical operator can be true
| Either condition surrounding the logical operator can be true

A condition is broken down into groups separated by the OR logical operator if there is any. If this group or any one of these groups is evaluated as true, the total condition is evaluated the same. The process of grouping can be altered by enclosing a portion or portions of the condition in parentheses.

Examples

Check if job name is equal to P25135:

JOB = 'P25135'

Check if SYSOUT ID begins with an R, S, or T:

ID LIKE ('R*','S*','T*')

Check if archive date is equal to today:

ARCHDATE = -0

Check if pages are between 5000 and 10000 lines (inclusive):

PAGES => 5000 AND PAGES <= 10000