COMP (Comparison) keyword for display files
You use this field-level keyword to specify that the IBM® i operating system is to compare the data that the workstation user types into an input or input/output field with the specified value.
The relational operator is the criterion for the comparison. If the data typed in this field fails this validity check, the IBM i operating system displays an error message. Note that the IBM i operating system performs this checking only if the field is changed by the workstation user or if its modified data tag (MDT) is set on using DSPATR(MDT).
The format of the keyword is:
COMP(relational-operator value)
You can specify only one operation for the COMP keyword and only one COMP keyword for a field.
The valid entries for the relational operator are:
- Relational operator
- Meaning
- EQ
- Equal
- NE
- Not equal
- LT
- Less than
- NL
- Not less than
- GT
- Greater than
- NG
- Not greater than
- LE
- Less than or equal
- GE
- Greater than or equal
The specified value must be either numeric or character, depending on the data type (decimal positions entry). Numeric values are expressed by the digits 0 through 9 and a leading sign (+ or -). Character values must be enclosed in single quotation marks.
You cannot specify the COMP keyword on a floating-point field (F in position 35).
Option indicators are not valid for this keyword.
Example
The following example shows how to specify the COMP keyword.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A FIELD2 6 OI 10 10COMP(EQ +021920)
00020A FIELD1 3 I 11 11COMP(EQ 'ABC')
A