× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Emily,

I've got two RPG IV programs. RPGPGM1 executes an ovrprtf on file
PRT1 and then opens it and writes data to it. This executes fine and
no errors are generated. RPGPGM1 then calls RPGPGM2. This program
closes PRT1 and then executes a DLTOVR on PRT1.

I don't really understand this. You say RPGPGM2 closes PRT1... does it also open it? Please keep in mind that a CLOSE in one RPG program won't affect a file that's opened in a different program. They open separate "paths" to that file...

As far as the DLTOVR... it sounds like you want it to delete the override from RPGPGM1? Is that what you truly want, if so, why? In order to accomplish THAT, you'll have to either use real activation groups, or you'll have to use OVRSCOPE(*JOB) (which I really don't recommend)

When you're using a *CALLLVL override scope, the overrides are scoped to the call stack level. OPM programs can only choose between *CALLLVL and *JOB scoping, and *CALLLVL is the default. ILE programs can also use scoping by the activation group -- but it sounds like you're deliberately using ACTGRP(*CALLER) to try to prevent your ILE programs from using activation groups.

With a *CALLLVL override, RPGPGM2 can never affect the override that's in RPGPGM1 because it's at a higher call stack level. In fact, unless you specify SECURE(*YES) on the override, RPGPGM2's overrides will be ignored, because RPGPGM1's override is at a lower call-stack level and therefore takes precedence.

If you change it to OVRSCOPE(*JOB), then the DLTOVR in RPGPGM2 will delete the override issued by RPGPGM1, and RPGPGM2's override will take affect (and possibly affect RPGPGM1, if it doesn't issue it's own override before re-opening the file).

Does this seem overly complex and confusing? Wouldn't it be more convenient if overrides only affected the one program they're issued in? Wouldn't that make things much less complex? Then USE ACTIVATION GROUPS!

When an override is scoped to the activation group, it only affects other programs that are in the same activation group. Therefore, if RPGPGM1 and RPGPGM2 run in separate activation groups, their overrides won't affect each other at all. Think of how that simplifies things!

Alternately, just specify SECURE(*YES) in RPGPGM2. Then both overrides will be in affect for RPGPGM2, but the SECURE(*YES) one will take precedence over the one program PGM1, and therefore will probably accomplish what you want. To me, that's a great deal more complicated, but it should also work.

Personally, I believe in encapsulation. Programs should stand alone, they shouldn't have to know or care how other programs work. It just makes maintenance so much simpler when you can change the logic in one program without having to re-test everything else in every conceivable job-stream to make sure you didn't break the other programs!

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.