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:
R JOINLFR JFILE(FILE1 FILE2)
J JOIN(1 2)
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.