On 3/9/2016 4:05 PM, Gerald Magnuson wrote:
when we got going with ILE we started creating modules (single procedure),
and then put them in a binding directory...
now we have found lots of instances where we modified the modules,
sometimes significantly, but didn't re-compile or updpgm...
Terminology is supposed to make our job easier, but that's not always
the case. The way I try to think of things:
Compile = CRTRPGMOD = source member -> *MODULE
Bind = CRTPGM = *MODULE (+ *MODULE (+ *MODULE...)) -> *PGM
This is called 'bind by copy'.
For the special case where there is exactly one source member that makes
exactly one module that makes exactly one program:
(Compile + Bind) = CRTBNDRPG = one source member -> one *MODULE -> one *PGM
If we use the two step process, CRTRPGMOD is not enough to alter the
executable *PGM. CRTRPGMOD creates a separate and distinct object from
the *PGM. CRTPGM copies that module (bind by copy) into the *PGM
object. Now we can delete the *MODULE, rename it, re-CRTRPGMOD on it;
anything we want. And the copy in the *PGM is unaffected until we do an
UPDPGM or CRTPGM, which once again copies the module into the *PGM.
does putting your modules into a service program, instead of a binding
directory, help with this?
if a module changes, and it is bound up in a service program, and we
re-compile the service program, does that somehow get the programs updated?
For service programs:
Compile = CRTRPGMOD = source member -> *MODULE
Bind = CRTSRVPGM = *MODULE (+ *MODULE (+ *MODULE...)) -> *SRVPGM
When we make a change to a sub-procedure in the *SRVPGM, we need to obey
the same rules as for *PGM objects. CRTRPGMOD will not get the changes
into production, because the copy ('bind by copy') of the *MODULE held
in the *SRVPGM hasn't been updated, just the separate *MODULE object.
Somewhere, we have a *PGM object which wants to use a sub-procedure
which is kept in that *SRVPGM. When the *PGM is created with CRTPGM or
CRTBNDRPG, the compiler looks [1] for the *SRVPGM and puts links to it
in the *PGM. This is called 'bind by reference'.
Now, when you change the sub-procedure:
Edit sub-procedure
CRTRPGMOD
UPDSRVPGM
At this point, every *PGM that uses that sub-procedure uses the new
code. So we don't have to re-bind every *PGM in the application, just
the one *SRVPGM.
[1] To keep it simpler I'll avoid discussing the whole mechanism in one
email.
As an Amazon Associate we earn from qualifying purchases.