Arranging records
By using the Open Query File (OPNQRYF) command,
you can arrange query records by the value of one or more key fields in various
ways and without using data description specifications (DDS).
Specifying dynamic keyed sequence access paths
The Open Query File (OPNQRYF) command supports dynamic keyed sequence access paths. That is, you can specify a keyed sequence access path without using data description specifications (DDS).
Specifying key fields from different physical files
The Open Query File (OPNQRYF) command allows you to specify a processing sequence for a join logical file in which the keys can be in different physical files (DDS restricts the keys to the primary file).
Unique-key processing
The Open Query File (OPNQRYF) command supports unique-key processing. It allows you to process only the first record of a group.
Random processing
In addition to sequential processing, you can use the OPNQRYF command for random processing (for example, the RPG language operation CHAIN or the COBOL language operation READ). However, if you use the grouping or unique-key function, you cannot process the file randomly.
Considerations for arranging records
Here are the considerations for arranging records using the Open Query File (OPNQRYF) command.