You can use the Open Query File (OPNQRYF) command for sequential processing. You can also use the OPNQRYF command for random processing.
You can use the OPNQRYF command for random processing operations (for example, the RPG/400® language operation CHAIN or the COBOL/400® language operation READ). However, if you are using the group or unique-key functions, you cannot process the file randomly.