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?
I forgot the SEQONLY(*NO) parameter. It must be present too.
And the RPG program must be compiled with the file with a similar key and using Keyed Access.