Record Caching

Caching records on a file-by-file basis involves these tasks:

  • Update the configuration file for an individual batch program.

  • Specify the number of records from a certain file to hold in memory while the program runs.

When the batch program needs access to a record from a file that has cached records, the program first checks the cache to see if the record is there. If it is, the program retrieves the record from the cache, bypassing the file on disk. If the record is not in the cache, the program reads the record from the disk and places it in the cache for future use, if there is room.

If a program adds, deletes, or updates records for a file that has cached records, changes are made in the cache, if necessary, and then in the file on disk.

Because it is faster to retrieve a record from memory (logical I/O) than disk (physical I/O), caching improves performance when used with batch programs that repeatedly read the same unchanging records. However, if you use caching with programs that perform many adds, updates, or deletes, performance is degraded by the need to change not only the records in the file but also in the cache. Therefore, when choosing files for caching, use only those files that are accessed frequently for read-only purposes on the same set of static records.