Simple cl containing a very simple OPNQRYF statement and an OVERDBF
SHARE(*YES).  Program was working for weeks, then for about 2 hours when
the program would be submitted to batch it was ignoring the OPNQRYF and
selecting all records... but if I submit on hold, then copy paste the
call on the command line it works fine, when I release... it selects all
records in the file or skips the opnqryf or ignores the SHARE????

Both the OVRDBF command and the OPNQRYF command have a paramter called "OPNSCOPE". This parameter determines which programs in the job will be affected by the override/open and which ones won't.

The default value is *ACTGRPDFN which means that the override scope is defined by the activation group that the command is run from. If it's run from the default activation group, then the scope is based on the call-level. When run from a different activation group, the scope is that activation group itself.

This means that if you call it from the command line (which is always the default activation group) the override and opnqryf will affect any programs that you call until you use CLOF/DLTOVR, or end the current call-stack entry (i.e. exit the command-prompt that you're running, such as when you sign off, or if you typed CALL QCMD, when you exit that call, etc.)

If you call it from an ILE CL program that's running in a genuine ILE activation group, however, the ovrdbf/opnqryf will only affect programs that happen to be in the same activation group.

Try changing the OVRDBF command to specify OVRSCOPE(*CALLLVL) and the OPNQRYF command to specify OVRSCOPE(*JOB). That seems to be the way you expect it to work, so you might as well code it that way :)

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page