Use this field-level keyword to specify validity checking for the field you are defining when it is referred to later during display file creation. For logical files, you can also specify this keyword at the select/omit-field level. COMP is equivalent to CMP.
COMP(relational-operator value)
COMP(relational-operator field-name)
Specify the value parameter at either the field level or the select/omit field level. Specify the field name parameter only at the select/omit field level.
The following example shows how to specify the COMP keyword for character and numeric strings.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A R RECORD PFILE(PF1) 00020A 00030A FIELDA 1 0 COMP(NE O) 1 C0040A FIELDB 1 COMP(NE 'A') 1 00050A FIELDC 00060A FIELDD 00070A FIELDE 00080A K FIELDB 00090A S FIELDC COMP(EQ FIELDD) 2 00100A S FIELDA COMP(NE O) 2 00110A S FIELDE COMP(NE *NULL) 2 00120A O FIELDB COMP(GE 'A') 2 A
The following example specifies the COMP keyword using a hexadecimal character string.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A R RCD1 PFILE(PF1) 00020A CODEA 00030A FLD1 00040A FLD2 00050A K FLD1 00060A S CODEA COMP(EQ X'51') A
COMP is specified as a select/omit keyword for CODEA (which is a 1-byte field). Records from physical file PF1 are retrieved through this record format only if the value of field CODEA is hex 51.