General relation conditions
A general relation condition compares two operands, either of which can be an identifier, literal, arithmetic expression, or index-name.
- operand-1
- The subject of the relation condition. Can be an identifier, literal, function-identifier, arithmetic expression, or index-name.
- operand-2
- The object of the relation condition. Can be an identifier, literal, function-identifier, 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 operators, shown in Table 1,
specify the type of comparison to be made. Each relational operator
must be preceded and followed by a space. The two characters of 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 |
Table 2 and Table 3 show the permissible pairs for comparisons with different types of operands. The comparison type is indicated at the row and column intersection for permitted comparisons, using the following key:
- Alph
- Comparison of alphanumeric characters (further described in Alphanumeric comparisons)
- DBCS
- Comparison of DBCS characters (further described in DBCS comparisons)
- Nat
- Comparison of national characters (further described in National comparisons)
- Num
- Comparison of algebraic value (further described in Numeric comparisons)
- Group
- Comparison of alphanumeric characters involving an alphanumeric group (further described in Group comparisons)
- (Int)
- Integer items only (combined with comparison type Alph, Nat, Num, or Group)
- Blank
- Comparison is not allowed
For rules and restrictions for comparisons involving index-names and index data items, see Comparison of index-names and index data items.
Introduction to Table 2: This table is organized in the following manner:
- In the first column, under "Type of data item or literal", each
row identifies a type of operand. In some cases, the type of operand
references a grouping of operands that have common properties for
comparison. For example, the row for "Alphanumeric character items"
references all the types of operands that are listed in the cell,
as follows:
- Data items of category:
- Alphanumeric
- Alphanumeric- edited
- Numeric-edited with usage DISPLAY
- Alphanumeric functions
- Data items of category:
- Subsequent column headings refer to the type of an operand or a grouping of operands. For example, the column heading "Alphabetic and alphanumeric character items" refers to the types of operands identified as "Alphabetic data items" and all the types of operands that are grouped under the operand titled "Alphanumeric character items".
- Literals are listed as a type of operand only in the first column. They do not appear as column headings because literals cannot be used as both operands of a relation condition.
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:
|
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 | Nat (Int) | Nat | DBCS | |
HIGH-VALUE,
LOW-VALUE QUOTE |
Group | Alph | Alph (Int) | Alph | Nat | Nat (Int) | Nat | ||
Symbolic character | Group | Alph | Alph (Int) | Alph | Nat | Nat (Int) | Nat | ||
ALL alphanumeric literal | Group | Alph | Alph (Int) | Alph | Nat | Nat (Int) | Nat | ||
ALL national literal | Group | Nat | Nat (Int) | Nat | Nat | Nat (Int) | Nat | Nat | |
ALL DBCS literal | Group | Nat | DBCS |