Binding by Copy
Binding by Copy
The modules specified on the MODULE parameter are always bound by copy. Modules named in a binding directory specified by the BNDDIR parameter are bound by copy if they are needed. A module named in a binding directory is needed in either of the following cases:
- The module provides an export for an unresolved import
- The module provides an export named in the current export block of the binder language source file being used to create a service program
If an export found in the binder language comes from a module object, that module is always bound by copy, regardless of whether it was explicitly provided on the command line or comes from a binding directory. For example,
Module M1: imports P2
Module M2: exports P2
Module M3: exports P3
Binder language S1: STRPGMEXP PGMLVL(*CURRENT)
EXPORT P3
ENDPGMEXP
Binding directory BNDDIR1: M2
M3
CRTSRVPGM SRVPGM(MYLIB/SRV1) MODULE(MYLIB/M1) SRCFILE(MYLIB/S1)
SRCMBR(S1) BNDDIR(MYLIB/BNDDIR1)
Service program SRV1 will have three modules: M1, M2, and M3. M3 is copied because P3 is in the current export block.