Access a OPNQRYF file using keys

5 pts.
Tags:
CHAIN
KEYFLD
OPNQRYF
READE
RPG
RPG/400
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.

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • WoodEngineer
    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.
    6,765 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following