On 2012/4/19 1:11 PM, Jon Paris wrote:
One small qualification to Brian's answer - only the names AND the
sequence in which they appear - have any effect on the signature.
Sadly parms have no effect - I wish they did.
If you want to force an error when a new version of a procedure is
called by an old caller, then you can do it with some hoop-jumping.
Say the procedure is called getName.
1. Create a new procedure, say getName_v2_dont_call_me_anymore, and have
it send an escape message to its caller saying that the calling module
has to be recompiled and the calling program recreated.
2. Replace getName by getName_v2_dont_call_me_anymore in the binder source.
3. Rename the real procedure to a new name, say getName_v2, and make the
mods to the parameters.
4. Add getName_v2 to the end of the binder source and recreate the
service program.
5. Change the RPG prototype to have EXTPROC('getName_v2').
6. Recompile all the callers of getName that you know about.
Before:
strpgmexp signature('MYSIG')
export ("something");
export ("getName");
export ("somethingElse");
D getName pr
D whatever ...
After:
strpgmexp signature('MYSIG')
export ("something");
export ("getName_v1_dont_call_me_anymore");
export ("somethingElse");
export ("getName_v2");
D getName pr extproc('getName_v2')
D changed parms ...
The advantage of this is that you don't change the signature so you
don't affect programs that are bound to the srvpgm, but that don't call
that particular procedure.
The disadvantage is that you don't get a signature violation when the
program gets called. Instead, you get an error when the program happens
to call the changed procedure, which might not happen right away.
But that could also be an advantage, since your message saying that the
caller needs to be recompiled might be easier to understand than the
signature violation message.
As an Amazon Associate we earn from qualifying purchases.