TechTalk: Overriding File Overrides

  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

From: James Moore To: All

I have a file inquiry program that presents a subfile of records from a master file. The user has an option field to choose other related files for a record. The subfile option calls another inquiry program from within the RPG program using the CALL op code.

My problem is this: I want to use this same program to inquire into our pending records files. (They are completely separate, although identical files.) When I code an OVRDBF in the CL that calls the RPG program, the master file is substituted correctly, but the auxiliary calls to the other inquiry programs are not overridden.

I'd like to know how to code the OVRDBF so that the overrides will take place on calls from within the called program? Is this possible?

From: Pete Hall To: James Moore

A file override is available for all programs called after it is in place, regardless of how far down on the invocation stack you go. However, it is possible to install another override at a lower invocation level that will nullify the first one. That could be what's happening with your job. I would suggest executing the program and looking at the overrides in use when you know that the wrong file is open. You can examine the cumulative effects of all overrides, and then look at each level individually with option 15 of the Display Job (DSPJOB) menu, to hopefully make some sense out of it.

From: James Moore To: Pete Hall

Thanks for the help. There weren't any other CL programs involved in this problem, so I never thought to check for subsequent overrides. It turns out the called programs were executing a CALL to QCMDEXC and doing another override. These programs were written with a CASE/code generating tool that I'm just now getting used to. They do save a lot of time in generating code; however, the downside is situations like this where the code does something you don't expect it to do.

Thanks again for the help-I'd probably still be pulling my hair out over this, and I cannot afford to do much more of that!