A logical file is a view over a physical file.
Most times it is created to define a specific access path.
But you could also create one to select only specific fields from the Physical File
Good CharlieBrown, but there is word confusion – an SQL view is somethine very different from a logical file .. it just feels the same. In native mode an RPG program can use a logical file without the ‘K’ in the ‘F’ spec. It can setll on *loval and read records from the file. I don’t think you can have an expectation of the record order when you do that.
Both physical files and logical files can be created without keys or with keys. Both can be accessed by RPG with keys and without keys. A PF or LF that was created with keys can be accessed by RPG without keys — the sequence will simply be “arrival sequence”, the order that the rows appear on physical disk. This is not an error that will be signaled.
A SQL TABLE is implemented as a special case of a PF. A SQL VIEW is implemented as a special case of a LF. Note that although LFs may have keys, a SQL VIEW cannot have a key.