If you are joining more than two files and you specify the JDFTVAL keyword, the default value supplied by the system for a join field missing from a secondary file is used to join to other secondary files.
If the DFT keyword is specified in the secondary file, the value specified for the DFT keyword is used in the logical file.
The data description specifications (DDS) for the files are shown as follows:
JLF |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A JDFTVAL A R JRCD JFILE(PF1 PF2 PF3) A J JOIN(PF1 PF2) A JFLD(NAME NAME) A J JOIN(PF2 PF3) A JFLD(TELEPHONE TELEPHONE) A NAME JREF(PF1) A ADDR A TELEPHONE JREF(PF2) A LOC A PF1 |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A R RCD1 A NAME 20 A ADDR 40 A COUNTRY 40 A PF2 |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A R RCD2 A NAME 20 A TELEPHONE 8 DFT('999-9999') A PF3 |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A R RCD3 A TELEPHONE 8 A LOC 30 DFT('No location assigned') A
Assume that PF1, PF2, and PF3 have the following records.
Name | Address | Country |
---|---|---|
Anne | 120 1st St. | USA |
Doug | 40 Pillsbury | Canada |
Mark | 2 Lakeside Dr. | Canada |
Sue | 120 Broadway | USA |
Name | Telephone |
---|---|
Anne | 555–1234 |
Doug | 555–2222 |
Sue | 555–1144 |
Telephone | Location |
---|---|
555–1234 | Room 312 |
555–2222 | Main lobby |
999–9999 | No telephone number |
With JDFTVAL specified in the join logical file, the program reads the following logical file records.
Name | Address | Telephone | Location |
---|---|---|---|
Anne | 120 1st St. | 555–1234 | Room 312 |
Doug | 40 Pillsbury | 555–2222 | Main lobby |
Mark | 2 Lakeside Dr. | 999–9999 | No telephone number |
Sue | 120 Broadway | 555–1144 | No location assigned |