Using More Than One Field to Join Files (Example 2)

You can specify more than one join field to join a pair of files. The following shows the fields in the logical file and the two physical files.
Logical File and Two Physical Files

The DDS for these files is as follows:



JLF
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A          R JOINREC                   JFILE(PF1 PF2)
     A          J                           JOIN(PF1 PF2)
     A                                      JFLD(PTNBR PTNBR)
     A                                      JFLD(COLOR COLOR)
     A            PTNBR                     JREF(PF1)
     A            COLOR                     JREF(PF1)
     A            PRICE
     A            QUANTOH
     A
 
PF1
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A          R REC1
     A            PTNBR          4
     A            COLOR         20
     A            PRICE          7  2
     A            VENDOR        40
     A
 
PF2
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A          R REC2
     A            PTNBR          4
     A            COLOR         20
     A            QUANTOH        5  0
     A            WAREHSE       30
     A

Assume that the physical files have the following records:
Examples of Records

If the file is processed sequentially, the program receives the following records:
Example of a Record

Note that no record for part number 190, color blue, is available to the program, because a match was not found on both fields in the secondary file. Because JDFTVAL was not specified, no record is returned.


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