< previous page page_811 next page >

Page 811
const int MAX_RECS = 100;         // Max. no. of records in a file
                                  //   (including sentinel record)
PersonRec firstList[MAX_RECS];    // Records from an input file
PersonRec secondList[MAX_RECS];   // Records from an input file
PersonRec tempList[MAX_RECS*2];   // Temporary merged list
PersonRec masterList[MAX_RECS*3]; // Final merged list
Each of firstList and secondList holds the records from one input file. The tempList array must be large enough to hold the merged records from two input files, and masterList holds the merged records from all three files.
Main                    Level 0
Open file1, file2, and file3 for input (and verify success)
Open masterFile for output (and verify success)
Get records from file1 into firstList
Get records from file2 into secondList
Merge firstList and secondList into tempList
Get records from file3 into firstList
Merge firstList and tempList into masterList
Write masterList to file masterFile

Get Records (Inout:inFile; Out: list)                    Level 1
Set index = 0
DO
   Read  list[index].lastName, list[index].firstName,
         list[index].phone.areaCode, list[index]. phone. phoneNumber from inFile
   Increment index
WHILE list[index-1] isn't the sentinel record

 
< previous page page_811 next page >