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 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 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. Records in iSeries database files can be described using either a field level description or 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 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 upto 32 record formats.|
|It can exist without logical file.||It cannot exist without physical file.|
|If there is a logical file for 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 object.||CRTLF command is used to make such object.|
Logical Storage Views – viewed by users are a collection of files organized within directories and storage volumes.
- 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.
- File is subdivided into records.
- Record usually contains information about a single customer, thing such as a product in inventory, or an event.
- Records are divided into fields.
- Fields are individual units of data.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Logical and Physical Address in Operating System
- Mapping Virtual Addresses to Physical Addresses
- Operating Systems | Input Output Systems | Question 5
- File Systems in Operating System
- Distributed File Systems
- Difference between Local File System (LFS) and Distributed File System (DFS)
- Logical Clock in Distributed System
- Starvation and Aging in Operating Systems
- Need and Functions of Operating Systems
- Static and Dynamic Linking in Operating Systems
- Introduction to Multi-threaded Architectures and Systems in OS
- Process Creation and Deletions in Operating Systems
- Difference between 32-bit and 64-bit operating systems
- Operating Systems | Set 1
- Operating Systems | Set 2
- Operating Systems | Set 3
- Operating Systems | Set 4
- Operating Systems | Set 5
- Operating Systems | Set 6
- Operating Systems | Set 10
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.