Physical Files and Logical Files

Physical files contain the actual data that is stored on an IBM® i, and a description of how data is to be presented to or received from a program. They contain only one record format, and one or more members.

A physical file can have a keyed sequence access path. This means that data is presented to an ILE C/C++ program in a sequence that is based on one or more key fields in the file.

Logical files do not contain data. They contain a description of records that are found in one or more physical files. A logical file is a view or representation of one or more physical files. Logical files that contain more than one format are referred to as multi-format logical files.

If your program processes a logical file which contains more than one record format, you can use the _Rformat() function to set the format you wish to use.

Some operations cannot be performed on logical files. If you open a logical file for stream file processing with open modes w, w+, wb, or wb+, the file is opened but not cleared. If you open a logical file for record file processing with open modes wr or wr+, the file is opened but not cleared.