Example: A logical file specifying multiple formats and new keys

The PFILE keyword is important in this example. The example uses new field specifications and provides two record formats. Each record format provides a different view of the associated physical file and uses a key different from the associated physical file.

Figure 1. DDS for a logical file specifying new keys
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A*
00020A* SAMPLE LOGICAL FILE
00030A
00040A          R CUSMST1                (1)PFILE(CUSMSTP)
00050A            ACTNUM
00060A            NAME
00070A            STATE
00080A            LASTNAME           I   (3)SST(NAME 8 10)
00090A    (2)   K ACTNUM
00100A*
00110A          R CUSMST2                (1)PFILE(CUSMSTP)
00120A            ACTNUM
00130A            NAME
00140A            ZIP
00150A          K *NONE
00160A    (2)   K NAME
     A
Legend:
(1)
The two record formats (CUSMST1 and CUSMST2) in this logical file are based on the same physical file (CUSMSTP).
(2)
Record format CUSMST1 has a key different from record format CUSMST2, providing the application program with a different sequence of the same records.
(3)
The LASTNAME field is a substring of the field NAME. The usage I in position 38 must be specified because this is not a join logical file.