How z/TPFDF recoup optimized chain chasing works

z/TPFDF recoup optimized chain chasing uses information in the index file to mark pool records for detail subfiles as in use without reading the detail subfiles. As a result, recoup optimized chain chasing reduces the amount of I/O resources that recoup uses and reduces the time that it takes recoup to run.

When the z/TPFDF index and detail files are both enabled for recoup optimized chain chasing, z/TPFDF automatically maintains a recoup optimized chain chase index flag in each index LREC. Recoup chain chasing uses the recoup optimized chain chase index flag to determine whether to use optimized or standard recoup chain chasing for the referenced detail subfile. If the recoup optimized chain chase index flag is set to NOCHASE, recoup uses optimized chain chasing and does not read the referenced detail subfile. If the recoup optimized chain chase index flag is set to any value other than NOCHASE, recoup uses standard chain chasing.

Figure 1 shows a z/TPFDF fixed record index file with 3 index LRECs. In this example, there are 2 index LRECs in ordinal 0, 1 index LREC in ordinal 2, and ordinal 1 is empty. Each index LREC references a detail subfile by using the file address (FA) of the prime block.

Figure 1. z/TPFDF index file with references to 3 detail subfiles
This figure illustrates a z/TPFDF index file with references to 3 detail subfiles, as described in the surrounding text.

For detail subfile A, z/TPFDF processing sets the recoup optimized chain chase index flag (ROCFlag) in the index LREC to NOCHASE, which indicates that detail subfile A consists of only 1 pool record. Because ROCFlag is set to NOCHASE, recoup can use optimized chain chasing for detail subfile A. With recoup optimized chain chasing, recoup uses the prime file address in the index LREC to mark the pool record for file address 123 as in use and moves to the next index LREC without reading the subfile. Recoup optimized chain chasing is used only for subfiles that consist of only 1 pool record because recoup can use the file address stored in the index LREC to mark the 1 pool record for that subfile as in use. If a large number of detail subfiles consist of only a single pool record, recoup can avoid a large amount of I/O processing while chain chasing the database.

Detail subfiles B and C both contain multiple pool records (standard overflows and an LLR). For both of these subfiles, ROCFlag is set to CHASE in the index LRECs. Therefore, recoup performs standard chain chasing by following all chains for both subfiles. This processing includes reading all pool records and marking pools as in use as the pool records are read.

If recoup optimized chain chasing is enabled for an existing database, the recoup optimized chain chase index flag is set to a binary zero (INITIAL) for all existing index references and recoup uses standard chain chasing for those detail subfiles. Optimized chain chasing is used only for single-record detail subfiles that were indexed after recoup optimized chain chasing was enabled.