Re: Modules vs Called programs
Here is how I do it... This is a very simple explanation where I leave out certain fringe scenarios that won't break what I list, but certain things that would *automagically* be covered by doing these things that you don't need to worry about at this time.
1) Create your procedures in your modules. This is what you have already done.
2) In your Binder Source only use the PGMLVL(*CURRENT) and specify your own signature that will never change SIGNATURE('MYSIG'). Now, in order for this to work you simply have to remember 1 simple rule. ALWAYS ADD NEW EXPORTS TO THE BOTTOM OF THE LIST. If you do that then you can add to your service program over time and you will not have to recompile all the programs that are bound to it because the signature didn't change. And because you put the new exports at the end of the list the ones that were already there are in the same order and will be found with no problems. Any programs that need the new procedures will get recompiled when they need them anyway.
3) Put your procedure prototypes (PR) in a copy source member. Then you don't have to specify the prototypes in EVERY program you want to use them in. Also, if the parameter list ever changes you won't have to change it in lots of different places. Just change it in the copy member and the module source and then recompile any callers.
4) You do not need CALLP. I use free form RPG and have NEVER used a CALLP. I simple do this... MyProcedure(Parm1:Parm2:ParmN); If I have a return variable is MyReturnVar = MyProcedure(Parm1:Parm2:ParmN);
5) When you make a change to your procedures that DOES NOT effect the prototypes you will not have to recompile the service program or any of the bound (or calling) programs. These are the steps...
1. Recompile Module
2. Update Service Program
That is it. If a prototype changed then you'll need to recompile the service program. Then only recompile the programs that actually need to use the effected procedure, which you would need to do anyway since the prototype changed. (I know, there are instances where the prototype can change and you don't need to recompile, that is beyond this scope though).
Here is how I do it... This is a very simple explanation where I leave out certain fringe scenarios that won't break what I list, but certain things that would *automagically* be covered by doing these things that you don't need to worry about at this time.
1) Create your procedures in your modules. This is what you have already done.
2) In your Binder Source only use the PGMLVL(*CURRENT) and specify your own signature that will never change SIGNATURE('MYSIG'). Now, in order for this to work you simply have to remember 1 simple rule. ALWAYS ADD NEW EXPORTS TO THE BOTTOM OF THE LIST. If you do that then you can add to your service program over time and you will not have to recompile all the programs that are bound to it because the signature didn't change. And because you put the new exports at the end of the list the ones that were already there are in the same order and will be found with no problems. Any programs that need the new procedures will get recompiled when they need them anyway.
3) Put your procedure prototypes (PR) in a copy source member. Then you don't have to specify the prototypes in EVERY program you want to use them in. Also, if the parameter list ever changes you won't have to change it in lots of different places. Just change it in the copy member and the module source and then recompile any callers.
4) You do not need CALLP. I use free form RPG and have NEVER used a CALLP. I simple do this... MyProcedure(Parm1:Parm2:ParmN); If I have a return variable is MyReturnVar = MyProcedure(Parm1:Parm2:ParmN);
5) When you make a change to your procedures that DOES NOT effect the prototypes you will not have to recompile the service program or any of the bound (or calling) programs. These are the steps...
1. Recompile Module
2. Update Service Program
That is it. If a prototype changed then you'll need to recompile the service program. Then only recompile the programs that actually need to use the effected procedure, which you would need to do anyway since the prototype changed. (I know, there are instances where the prototype can change and you don't need to recompile, that is beyond this scope though).
Comment