DDS concepts
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:
- JOIN is required when more than two physical files are being joined, and
it identifies which two files are being joined in this join
specification. In the first join specification, PF1 and PF2 are
joined. In the second join specification, PF2 and PF3 are
joined.
- 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.
- JFLD identifies which fields are used to link together records from the
physical files being joined. In the first join specification, NAME from
PF1 links with NAME from PF2. In the second join specification, NAME
from PF2 links with NAME from PF3.
- (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 ]
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.