Describing Logical File Record Formats

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:

  1. In the simple logical file record format, specify only the record format name and the PFILE keyword. The record format for the only (or first) physical file specified on the PFILE keyword is the record format for the logical file. The record format name specified in the logical file must be the same as the record format name in the only (or first) physical file.

    Figure 7. Simple Logical File

    |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
         A
         A          R ORDDTL                    PFILE(ORDDTLP)
         A
    

  2. In the following example, you describe your own record format by listing the field names you want to include. You can specify the field names in a different order, rename fields using the RENAME keyword, combine fields using the CONCAT keyword, and use specific positions of a field using the SST keyword. You can also override attributes of the fields by specifying different attributes in the logical file.

    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
    

  3. In the following example, the file name specified on the FORMAT keyword is the name of a database file. The record format is shared from this database file by the logical file being described. The file name can be qualified by a library name. If a library name is not specified, the library list is used to find the file. The file must exist when the file you are describing is created. In addition, the record format name you specify in the logical file must be the same as one of the record format names in the file you specify on the FORMAT keyword.



    |...+....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.
Examples of Files

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
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.
Note:For information about mapping DBCS fields, see Appendix B, "Double-Byte Character Set (DBCS) Considerations".


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]