For every logical file record format described with DDS, you must specify a record format name and either the PFILE keyword (for simple and multiple format logical files), or the JFILE keyword (for join logical files). The file names specified on the PFILE or JFILE keyword are the physical files that the logical file is based on. A simple or multiple-format logical file record format can be specified with DDS in any one of the following ways:
Figure 7. Simple Logical File
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A
A R ORDDTL PFILE(ORDDTLP)
A
Figure 8. Simple Logical File with Fields Specified
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A
A R ORDHDR PFILE(ORDHDRP)
A ORDER
A CUST
A SHPVIA
A
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A
A R CUSRCD PFILE(CUSMSTP)
A FORMAT(CUSMSTL)
A
In the following example, a program needs:
You can use a logical file to make these changes.

For the logical file, the DDS would be:
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A
A R LOGREC PFILE(PF1)
A D 10S 0
A A
A C 5S 0
A
For the physical file, the DDS would be:
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A
A R PHYREC
A A 8S 2
A B 32
A C 2B 0
A D 10
A
When a record is read from the logical file, the fields from the physical file are changed to match the logical file description. If the program updates or adds a record, the fields are changed back. For an add or update operation using a logical file, the program must supply data that conforms with the format used by the logical file.
The following chart shows what types of data mapping are valid between
physical and logical files.
| Physical File Data Type | Logical File Data Type | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Character or Hexadecimal | Zoned | Packed | Binary | Floating Point | Date | Time | Timestamp | |||
| Character or Hexadecimal | Valid | See Note 1 | Not valid | Not valid | Not valid | Not valid | Not valid | Not valid | ||
| Zoned | See Note 1 | Valid | Valid | See Note 2 | Valid | Not valid | Not valid | Not Valid | ||
| Packed | Not valid | Valid | Valid | See Note 2 | Valid | Not valid | Not valid | Not valid | ||
| Binary | Not valid | See Note 2 | See Note 2 | See Note 3 | See Note 2 | Not valid | Not valid | Not valid | ||
| Floating Point | Not valid | Valid | Valid | See Note 2 | Valid | Not valid | Not valid | Not valid | ||
| Date | Not valid | Valid | Not valid | Not valid | Not valid | Valid | Not valid | Not valid | ||
| Time | Not valid | Valid | Not valid | Not valid | Not valid | Not valid | Valid | Not valid | ||
| Time Stamp | Not valid | Not valid | Not valid | Not valid | Not valid | Valid | Valid | Valid | ||
| ||||||||||
| Note: | For information about mapping DBCS fields, see Appendix B, "Double-Byte Character Set (DBCS) Considerations". |