Case 1: Matching records in primary and secondary files

 

This example join logical file contains a single record for each record in the primary file because each record in the primary file has 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, and four records are contained in both PF1 and PF2, as shown in the following two tables.

Table 1. Physical file 1 (PF1)
Employee number Name
235 Anne
440 Doug
500 Mark
729 Sue

Table 2. Physical file 2 (PF2)
Employee number Salary
235 1700.00
440 950.50
500 2100.00
729 1400.90

The program does four read operations and gets the following records.

Table 3. Join logical file (JLF)
Employee number Name Salary
235 Anne 1700.00
440 Doug 950.50
500 Mark 2100.00
729 Sue 1400.90

 

Parent topic:

Example 1: Basic concepts of joining two physical files