COMP (Comparison) Keyword for Physical and Logical Files--Examples

Figure 25 shows how to specify the COMP keyword for character and numeric strings.

Figure 25. Specifying the COMP Keyword (Example 1)

|...+....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

(1)
COMP is specified for FIELDA and FIELDB as a validity checking keyword for display files that refer to FIELDA and FIELDB.

(2)
COMP is specified as a select/omit keyword for FIELDC, FIELDA, FIELDB, and FIELDE. Records from the physical file PF1 are retrieved through this logical file record format depending on the following comparisons:

Figure 26 specifies the COMP keyword using a hexadecimal character string.

Figure 26. Specifying the COMP Keyword (Example 2)

|...+....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.