OPNQRYF to emulate a joined logical file

135 pts.
Tags:
AS/400 Query
iSeries
Joined Logicals
Hello everyone, I'm in a bit of a bind here. Hope you could help me.

We have a requirement where we should modify an CLLE program to switch reading a file between two libraries (depending on the entry parameter). This would then be read by a called RPGLE program.

Switch 1: Read environment library/joined logical file
Switch 2: Read archive library/joined logical file

We know OVRDBF can do the trick, but that's not all. Here's the tricky part:

The joined logical file source:
JOINLF (LF)
R JOINLFR JFILE(FILE1 FILE2)
J JOIN(1 2)
JFLD(F1FLD F2FLD)
...

When the CLLE is in switch 2, they want the joined logical to read from Environment/FILE1 and Archive/FILE2. It's like this now:

Switch 1: Environment joined logical file (read FILE1 and FILE2 from environment library)
Switch 2: Archive joined logical file (read environment FILE1 and archive FILE2)

Switch 1 is not a problem. For switch 2: They don't want us to modify the archive joined logical file source, nor create a new one. So we thought of using OPNQRYF for this:

OVRDBF FILE(JOINLF) TOFILE(FILE1) SHARE(*YES)
OPNQRYF FILE((ENV/FILE1) (ARC/FILE2)) FORMAT(JOINLF) JFLD((F1FLD F2FLD)) OPNID(JOINLF) SEQONLY(*NO)

It looks promising. But we get a CPF4131 in the RPGLE program when testing the switch 2. Is there a problem with the OVRDBF/OPNQRYF syntax or is it impossible to use OPNQRYF to emulate a joined logical file?

Please share your thoughts and experiences about this.


Software/Hardware used:
iseries, as400, rpgle
ASKED: February 19, 2014  1:20 AM

Answer Wiki

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

Discuss This Question:  

 
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

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