Case 2B: A record missing in the secondary file (JDFTVAL keyword specified)
Because the Join Default Values (JDFTVAL) DDS keyword is specified, this example join logical file contains a single record for each record in the primary file even though one record does not have a match in the secondary file.
Assume that a join logical file is specified as in Example 1: Basic concepts of joining two physical files, except that the JDFTVAL keyword is specified, as shown in the following DDS:
JLF |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A JDFTVAL A R JOINREC JFILE(PF1 PF2) A J JOIN(PF1 PF2) A JFLD(NBR NBR) A NBR JREF(PF1) A NAME A SALARY A K NBR AThe program reads the join logical file and gets the following records.
Table 1. Join logical file (JLF) Employee number Name Salary 235 Anne 1700.00 440 Doug 950.50 500 Mark 0000.00 729 Sue 1400.90 With JDFTVAL specified, the system returns a record for 500, even though the record is missing in PF2. Without that record, some field values can be missing in the join record. In this case, the Salary field is missing. With JDFTVAL specified, missing character fields normally use blanks; missing numeric fields use zeros. Therefore, in this case, the value for the missing record in the join record is 0. However, if the DFT keyword is specified for the field in the physical file, the default value specified on the DFT keyword is used.
Parent topic:
Example 1: Basic concepts of joining two physical files