DDS concepts

Example of a join logical file

The following join logical file joins three physical files (PF1, PF2, and PF3) so that an application program can get name, address, and salary information in one input operation, even though the information is stored in three different physical files. The following keywords are important in the example:

Figure 6. DDS for a Join Logical File

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A       (1)R JOINREC               (2) JFILE(PF1 PF2 PF3)
00020A          J                           JOIN(PF1 PF2)
00030A       (3)                            JFLD(NAME NAME)
00040A          J                           JOIN(PF2 PF3)
00050A                                      JFLD(NAME NAME)
00060A       (4)  NAME                 (5)  JREF(1)
00070A       (4)  ADDR
00080A       (4)  PHONE
00090A       (4)  SALARY
     A

Legend:

(1)
R identifies the record format. There can be only one record format in a join logical file.

(2)
The JFILE keyword specifies that PF1, PF2, and PF3 are the physical files on which this join logical file is based. Because it is specified first, PF1 is the primary file. There are two secondary files: PF2 and PF3.

(3)
J identifies the join specifications. With two secondary files in this join logical file, there must be two join specifications. Each join specification defines how a pair of files is to be joined, as follows:
Note:
Secondary files can be joined to either the primary file or to another secondary file. In this example, PF2 in the second JOIN keyword could be PF1; there would be no difference in the order of records supplied to the program or in performance.

(4)
The field names show which fields are presented to the program. At least one field name is required.

(5)
The JREF keyword identifies which physical file to search for the field name; in this example, NAME from PF1 is used. Note the use of the direct file number: JREF(1) indicates to use the first file on the JFILE keyword, which is PF1.


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