Physical and Logical File Systems
Last Updated :
27 Apr, 2022
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.
Similar Reads
Logical and Physical Address in Operating System A logical address is generated by the CPU while a program is running. The logical address is a virtual address as it does not exist physically, therefore, it is also known as a Virtual Address. The physical address describes the precise position of necessary data in a memory. Before they are used, t
5 min read
File System Inconsistency File systems in the OS have mechanisms to persist despite abrupt power changes, thereby handling the problem of crash consistency. To understand the crash scenario, assume that a user has given the "write" instruction onto the disk, and in between the process someone unplugs the power cord. The disk
3 min read
Log-Structured File System (LFS) Log-Structured File Systems were introduced by Rosenblum and Ousterhout in the early 90's to address the following issues. Growing system memories: With growing disk sizes, the amount of data that can be cached also increases. Since reads are serviced by the cache, the file system performance begins
5 min read
Compare file system in Windows and Linux File System in Linux : Linux supports more than 12 file systems with NFS technology. When Linux (that is, operating system code) is linked, the default file system option needs to be specified. other file systems can be called dynamically depending on requirements. Ext file system is the most popula
3 min read
File Systems in Operating System A computer file is defined as a medium used for saving and managing data in the computer system. The data stored in the computer system is completely in digital format, although there can be various types of files that help us to store the data.File systems are a crucial part of any operating system
8 min read