Example: A logical file specifying a new record format

The UNIQUE keyword is important in this example. The example specifies a record format different from the associated physical file.

The following logical file (called CUSMSTL2 for customer master logical file two) uses some of the fields in the physical file CUSMSTP. Another logical file can name all fields, name fields in other physical files as well, concatenate fields, change the order of fields, rename fields, or choose different key fields. In this logical file, the programmer merely omitted some fields from the physical file.

Figure 1. DDS for a logical file
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A*
00020A* SAMPLE LOGICAL FILE (CUSMSTL2)
00030A*
00040A                                   (1)UNIQUE
00050A          R CUSREC                 (2)PFILE(CUSMSTP)
00060A                                      TEXT('Logical File Master Record')
00070A            ACTNUM  (3)
00080A            NAME    (3)
00090A            ADDR    (3)
00100A       (4)K ACTNUM
     A
Legend:
(1)
The UNIQUE keyword specifies that records with duplicate keys are not allowed within a member of this logical file.
(2)
The keyword PFILE (required for logical files) specifies CUSMSTP.
(3)
The field names do not have R specified in position 29 as they do in physical files or in any device file.
(4)
As in CUSMSTP, the field ACTNUM is treated as a key field.