Logical file in AS400 |
Introduction
The Logical file (LF) is a database file object that does not contain actual data but denotes how the data is actually retrieved to the RPG or CL program. It is simply an access path to the data over the physical file. Any logical file (LF) cannot exist without the physical file (PF) existence i.e. Logical files (LF) are dependent files of the physical files (PF).
A Logical file (LF) with Keys are Access path (INDEX) over the physical file (PF) and a Logical file (LF) with no key are VIEWS over the physical file (PF).
A logical file (LF) can have a maximum of up to 32 record formats defined in it and has a permanent object on the IBM i system where we can specify filter criteria as well using SELECT or OMIT criteria.
If there is/are Logical files (LF) present for a physical file (PF) then we cannot delete Physical file (PF) until and unless we delete all the dependent Logical files (LF) over that physical file (PF). But Logical file (LF) can be deleted without deleting the Physical file (PF) first.
The Create Logical File (CRTLF) command is used to create the Logical file over the Physical file (PF)
CRTLF FILE(EASYCLASS1/DUMMY) SRCFILE(EASYCLASS1/QDDSSRC) SRCMBR(DUMMY)
CRTLF |
We need to provide the LF name, the library where LF gets created, the source file, the source file library, and the source member used to create the LF.
Once the LF is created we see the object of any LF as follows using the WRKOBJ command.LF object has a type of *FILE and attribute as LF.
Logical file |
Types of Logical Files
There are 2 types of Logical files (LF) that exist. Please follow the below link to read about them.
Related Post
- Non-Join Logical file in AS400
- Join Logical file in AS400
- Join two physical files to create Join logical file in AS400
- Join more than one physical file field to create Join logical file in AS400
- Use JDUPSEQ keyword to arrange duplicate records in secondary file in join logical file in AS400
- Join fields with different attributes to create a Join logical file in AS400
- Fields that never appear in Record format in Join Logical File in AS400
- Specify the key fields in the Join Logical File in AS400
- Joining three or more physical files to create Join Logical File in AS400
- Joining physical file to itself in Join Logical File in AS400
- Select and Omit criteria in Logical file in AS400