You can create a view in runtime for a Physical file using OPNQRYF.
OPNQRYF FILE((lib/pf)) OPTION(*UPD) QRYSLT(‘CDE +
*EQ 101 ‘) KEYFLD((CDE))
The Above statement will create a view for PF in runtime.
Option ‘*UPD indicates to Open the file for update operations.
QRYSLT is used to filter the records, In this case PF will pick up the records only if CDE equals to ’101′.
KEYFLD(CDE), CDE will act as a Keyfield in this case and Records will be ordered based on CDE.