A general relation condition compares two operands, either of which can be an identifier, literal, arithmetic expression, or index-name.
An alphanumeric literal can be enclosed in parentheses within a relation condition.
The relation condition must contain at least one reference to an identifier.
The relational operator specifies the type of comparison to be made, as shown in Relational operators and their meanings (Table 23). Each relational operator must be preceded and followed by a space. The relational operators >= and <= must not have a space between them.
| Relational operator | Can be written | Meaning |
|---|---|---|
| IS GREATER THAN | IS > | Greater than |
| IS NOT GREATER THAN | IS NOT > | Not greater than |
| IS LESS THAN | IS < | Less than |
| IS NOT LESS THAN | IS NOT < | Not less than |
| IS EQUAL TO | IS = | Equal to |
| IS NOT EQUAL TO | IS NOT = | Not equal to |
| IS GREATER THAN OR EQUAL TO | IS >= | Is greater than or equal to |
| IS LESS THAN OR EQUAL TO | IS <= | Is less than or equal to |
In a general relation condition, data items, literals, and figurative constants of class alphabetic, alphanumeric, DBCS, national, and numeric are compared using the following comparison types:
| Comparison type | Meaning |
|---|---|
| Alphanumeric | Comparison of the alphanumeric character value of two operands |
| DBCS | Comparison of the DBCS character value of two operands |
| National | Comparison of the national character value of two operands |
| Numeric | Comparison of the algebraic value of two operands |
| Group | Comparison of the alphanumeric character value of two operands, where one or both operands is an alphanumeric group item |
The tables below, Comparisons involving data items and literals (Table 24) and Comparisons involving figurative constants (Table 25), show the permissible pairs of comparisons with different types of operands. The comparison type is indicated at the row and column intersection for permitted comparisons, using the following key:
For rules and restrictions for comparisons involving year-last date fields, see Comparison of date fields.
For rules and restrictions for comparisons involving index-names and index data items, see Comparison of index-names and index data items.
Introduction to Comparisons involving data items and literals (Table 24): This table is organized in the following manner:
| Type of data item or literal | Alpha- numeric group items | Alpha- betic and alpha- numeric character items | Zoned decimal items | Native numeric items | Alpha- numeric floating- point items | National character items | National decimal items | National floating- point items | DBCS items |
|---|---|---|---|---|---|---|---|---|---|
| Alphanumeric group item | Group | Group | Group (Int) | Group | Group | Group (Int) | Group | Group | |
| Alphabetic data items | Group | Alph | Alph (Int) | Alph | Nat | Alph (Int) | Nat | ||
Alphanumeric
character items:
|
Group | Alph | Alph (Int) | Alph | Nat | Alph (Int) | Nat | ||
| Alphanumeric literals | Group | Alph | Alph (Int) | Alph | Nat | Alph (Int) | Nat | ||
| Numeric literals | Group (Int) | Alph (Int) | Num | Num | Num | Nat (Int) | Num | Num | |
| Zoned decimal data items | Group (Int) | Alph (Int) | Num | Num | Num | Nat (Int) | Num | Num | |
Native numeric
items:
Numeric and integer intrinsic functions |
Num | Num | Num | Num | Num | ||||
| Display floating-point items | Group | Alph | Num | Num | Num | Nat | Num | Num | |
| Floating-point literals | Num | Num | Num | Num | Num | ||||
National character
items:
|
Group | Nat | Nat (Int) | Nat | Nat | Nat (Int) | Nat | Nat | |
| National literals | Group | Nat | Nat (Int) | Nat | Nat | Nat (Int) | Nat | Nat | |
| National decimal items | Group (Int) | Alph (Int) | Num | Num | Num | Nat (Int) | Num | Num | |
| National floating-point items | Group | Nat | Num | Num | Num | Nat | Num | Num | |
| DBCS data items | Group | Nat | DBCS | ||||||
| DBCS literals | Group | Nat | DBCS |
| Figurative constant | Alpha- numeric group items | Alpha- betic and alpha- numeric character items | Zoned decimal items | Native numeric items | Alpha- numeric floating point items | National character items | National decimal items | National floating point items | DBCS items |
|---|---|---|---|---|---|---|---|---|---|
| ZERO | Group | Alph | Num | Num | Num | Nat | Num | Num | |
| SPACE | Group | Alph | Alph (Int) | Alph | Nat | Alph (Int) | Nat | DBCS | |
| HIGH-VALUE,
LOW-VALUE QUOTE |
Group | Alph | Alph (Int) | Alph | Nat | Alph (Int) | Nat | ||
| Symbolic character | Group | Alph | Alph (Int) | Alph | Nat | Alph (Int) | Nat | ||
| ALL alphanumeric literal | Group | Alph | Alph (Int) | Alph | Nat | Alph (Int) | Nat | ||
| ALL national literal | Group | Nat | Nat (Int) | Nat | Nat | Nat (Int) | Nat | Nat | |
| ALL DBCS literal | Group | Nat | DBCS |