190 pts.
 OVRDBF & OPNQRY – AS/400 question
AS/400 question: Say, there are 3 programs. RPG 1, RPG2 & RPG 3. I have OVRDBF and OPNQRY which selects only active customer records. I want RPG 1 to use the OPNQRYF output data. I want RPG 2 to use the complete data I want RPG 3 to use the OPNQRYF output data again. This is how it was answered: RPG1 and RPG 3 can use share (*yes) and RPG 2 can use share(*no). Can anyone please tell me if this is correct? Thanks.

Software/Hardware used:
ASKED: February 6, 2013  8:11 AM
UPDATED: February 6, 2013  4:03 PM

Answer Wiki:
programs are contemporary-nested or sequential?
Last Wiki Answer Submitted:  February 7, 2013  4:02 pm  by  nuccio   290 pts.
All Answer Wiki Contributors:  nuccio   290 pts. , juslikdat1   190 pts. , Michael Tidmarsh   11,410 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

If the interview asked more than two questions about OPNQRYF, I might consider thanking them for the interview and leaving. It’s probably not an environment that I’d want to work in. I last used OPNQRYF around 10 years ago, and then it was because I was modifying a program that already had OPNQRYF in it.
 
OPNQRYF is a System/38 command that was brought to the AS/400 in the beginning. It has been useful, but it long ago became nearly obsolete. There have long been better ways of doing almost everything that it does.
 
RPG1 and RPG 3 can use share (*yes) and RPG 2 can use share(*no). Can anyone please tell me if this is correct?
 
I’ve never tried it. It could be tricky making the overrides effective. It might work. It’s probably not how I’d do it, though. Your question 2 is probably related to how I’d do it.
 
Tom

 108,260 pts.

 

OPNWRYF has gone by the wayside since you can embed SQL. There may still be some legacy code out there that uses it but there are more efficient ways to code today. As for your question I agree with Tom. It might work with a little creative coding of the overrides. If these jobs run in sequence you could DLTOVR before RPG2 runs then OVRDBF before you run RPG3.

 3,915 pts.

 

…you could DLTOVR before RPG2 runs then OVRDBF before you run RPG3.
 
Alternatively, the OVRDBF might only be applied before RPG2 and deleted after. It depends on whether or not the file already has the SHARE(*YES) attribute, which is uncommon.
 
Tom

 108,260 pts.