Open In App

Physical and Logical File Systems

Last Updated : 27 Apr, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

1. Physical files: Physical files contain the actual data that is stored on an iSeries system, 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. Records in database files can be described using either a field-level description or a record-level description. A field-level description describes the fields in the record to the system. Database files that are created with field-level descriptions are referred to as externally described files. A record-level description describes only the length of the record, and not the contents of the record. Database files that are created with record-level descriptions are referred to as program-described files. This means that your ILE C/C++ program must describe the fields in the record.

An ILE C/C++ program can use either externally described or program-described files. If it uses an externally described file, the ILE C/C++ compiler can extract information from the externally described file, and automatically include field information in your program. Your program does not need to define the field information. For further information see “Using Externally Described Files in Your Programs”. 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. 

2. Logical files: 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 that 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. Records in iSeries database files can be described using either a field-level description or a record-level description. The field-level description of the record includes a description of all fields and their arrangement in this record. Since the description of the fields and their arrangement is kept within a database file and not in your ILE C/C++ program, database files created with a field-level description are referred to as externally described files. 

Physical versus Logical Files :

  • Physical File: A collection of bytes stored on a disk or tape.
  • Logical File: A “Channel” (like a telephone line) that hides the details of the file’s location and physical format to the program.

When a program wants to use a particular file, “data”, the operating system must find the physical file called “data” and make a logical name by assigning a logical file to it. This logical file has a logical name which is what is used inside the program.

Physical File Logical File
It occupies the portion of memory. It contains the original data. It does not occupy memory space. It does not contain data.
A physical file contains one record format. It can contain up to 32 record formats.
It can exist without a logical file. It cannot exist without a physical file.
If there is a logical file for the physical file, the physical file cannot be deleted until and unless we delete the logical file. If there is a logical file for a physical file, the logical file can be deleted without deleting the physical file.
CRTPF command is used to make such an object. CRTLF command is used to make such an object.
Physical files represent the real data saved on an iSeries system and describe how the data is to be displayed to or retrieved from a program.  The logical file represents one or multiple physical files. It also has a description of the records found in one or multiple physical files.
If there is a logical file for a physical file, the physical file can’t be deleted until and unless we delete the Logical file. If there is a logical file for a physical file, the logical file can be deleted without deleting the physical file.

Logical Storage Views: viewed by users are a collection of files organized within directories and storage volumes.

  • The logical file structure is independent of its physical implementation.
  • Logical file structure “ignores”.

Physical storage allocations: records can be stored in separate file locations. Data access methods and Data encoding methods.

Physical Storage Views: a collection of physical storage locations organized as a linear address space.

  • The file is subdivided into records.
  • The record usually contains information about a single customer, things such as a product in inventory, or an event.
  • Records are divided into fields.
  • Fields are individual units of data.

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads