Upon completion of this chapter, you should be able to

  • Explain the purpose of logical files.

  • Explain the differences between physical files and logical files.

  • Explain how logical files are defined.

  • Describe the various forms of logical files that can be used to define access paths to data stored in physical files.

  • Demonstrate the use of logical files in application programs.


There will be times when a user needs to access a physical file in some manner other than the way the physical file is defined. For example, a user may want to access employee records using either a Social Security number or a name as the key field. Similarly, a user may wish to group employees and print or display them by department number or city. An accounts receivable clerk may wish to access only those accounts that exceed a certain balance. In another situation, a user may wish to select or omit specific records from a physical file or even select or omit fields within the records. A logical file can be used to accomplish all of these tasks.

A logical file defines an access path to data stored in one or more physical files. Logical files do not contain any data themselves but provide a view of data from physical files. The logical view allows a user to decide what data are to be retrieved from the physical file or files and the format in which they are to appear.

Logical files may be used to

  1. Sequence data in a physical file in a different order.

  2. Select or ...

Get PROGRAMMING IN COBOL/400: 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.