Q: What is the difference between specifying OVRSCOPE(*CALLLVL) versus OVRSCOPE(*ACTGRPDFN) on the OVRDBF command in an ILE CL program?
A: Each time a program opens a file, the system checks whether there's an override that should have an effect on that open. The OVRSCOPE parameter controls the scope of the override—it answers the question "which opens should use this override?"
*CALLLVL means that the override is scoped to the call level. Think about what happens when one program calls another program, and that program calls a third program . . . you end up with something very much like a "stack" of programs. For instance:
PGM1 --calls--> PGM2 --calls--> PGM3
If PGM2 sets an override with *CALLLVL, it'll affect PGM2 and PGM3 but not PGM1. When PGM2 ends, its *CALLLVL overrides are automatically deleted. That's what *CALLLVL means: the override takes place at the call level and is deleted when the call level ends.
*CALLLVL was the default option for OVRSCOPE prior to V2R3. Back then, your only options were *CALLLVL and *JOB. *JOB always affected subsequent opens in the job, no matter which call stack level those opens occurred at. *JOB often causes conflicts, for instance if you forget to delete a job level override, it might affect a subsequent program, even though that program might be completely unrelated to the one that issued the override. Because of the conflicts it creates, *JOB should be avoided wherever possible.
*ACTGRPDFN—stands for "activation group defined" and has been the default value of the OVRSCOPE parameter since V2R3. It means that the override scope will work differently depending on the activation group it's issued from. So you might ask yourself, "What is the override scope of this override?" and the answer would be, "It's activation group defined." Meaning, it's defined by the activation group.
So what are the possible activation groups of a program, and how will the override scope behave?
- *DFTACTGRP—override will be scoped to the call level (identical to *CALLLVL). Since OPM programs always run in this activation group, they work the same as always. Likewise, ILE programs that run in the default activation group will work like their OPM counterparts.
- NAMED actgrp (including QILE)—override will affect any file opens that are in that activation group only. Like *JOB, the call level doesn't matter, but unlike *JOB, it affects only one activation group—the one from which the override was issued. File opens in different named activation groups, the default activation group, and so forth, are unaffected.
- *NEW—this is identical to NAMED, except that the name of the activation group is generated by the system.
- *CALLER—depends on where the program was called from. If called from the default activation group, see *DFTACTGRP, above, otherwise see NAMED actgrp, above.
What this boils down to is that there are really only two possibilities. *DFTACTGRP will behave like *CALLLVL, and anything else will be scoped so that it affects only the activation group that the override was issued from.