Describe logical file record formats

For every logical file record format described with data description specifications (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:
In the following example, a program needs:

You can use a logical file to make these changes.


Examples of files

For the logical file, the DDS would be as follows:

|...+....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 as follows:

|...+....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 Notes 1 Not valid Not valid Not valid Not valid Not valid Not valid
Zoned See Notes 1 Valid Valid See Notes 2 Valid Not valid Not valid Not Valid
Packed Not valid Valid Valid See Notes 2 Valid Not valid Not valid Not valid
Binary Not valid See Notes 2 See Notes 2 See Notes 3 See Notes 2 Not valid Not valid Not valid
Floating point Not valid Valid Valid See Notes 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
Notes:
  1. Valid only if the number of characters or bytes equals the number of digits.
  2. Valid only if the binary field has zero decimal positions.
  3. Valid only if both binary fields have the same number of decimal positions.
Related concepts
Double-byte character set considerations