5 pts.
 OPNQRYF
Is it possible to access a file created by opnqryf in an RPG/400 program using keys? I have defined the KEYFLD parameter but the RPG doesn't find the records when using READE or CHAIN

Software/Hardware used:
ASKED: May 14, 2009  3:37 PM
UPDATED: May 18, 2009  3:52 PM

Answer Wiki:
Hi, Have you used OVRDBF SAHRE(*YES) on your file? OPNQRYF won't work without it. If you are using OvrDbf, are you using KEYFLD keyword on OPNQRYF? Regards, Wilson I forgot the SEQONLY(*NO) parameter. It must be present too. Wilson ////////////////////////// And the RPG program must be compiled with the file with a similar key and using Keyed Access. Phil
Last Wiki Answer Submitted:  May 15, 2009  1:18 pm  by  WilsonAlano   2,385 pts.
All Answer Wiki Contributors:  WilsonAlano   2,385 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

CPYFRMQRYF might do what you want. Its a bit like CPYF but uses everything you have coded into your OPNQRYF command. This is an efficient way to handle data if multiple programs need to work with the same OPNQRYF data. It prevents the overhead of multiple OPNQRYF’s which select, sequence, group, key the same data.

All the same rules apply, just as if you were reading the results into an RPG or COBOL program.

 5,525 pts.