Binding the Modules into the Program
Program A will be created from M1.
Service program SP1 will be created from M2.
Service program SP2 is created from M3.
If you try and create service program
SP1 from
module M2, using the binder language shown in Figure 1 and the compiler invocation:
CRTSRVPGM SRVPGM(MYLIB/SP1) MODULE(MYLIB/M2)
SRCFILE(MYLIB/QSRVSRC) SRCMBR(BNDLANG1)you find that
the binder tries to resolve the import for function func2(),
but fails, because it is not able to find a matching export. Therefore,
service program SP1 is not created.If
SP1 is not created, this leads to problems
if you try and create service program SP2 from module M3 using
the binder language shown in Figure 2 and the compiler invocation:
CRTSRVPGM SRVPGM(MYLIB/SP2) MODULE(MYLIB/M3)
SRCFILE(MYLIB/QSRVSRC) SRCMBR(BNDLANG2)Service program SP2 is not created, because the
binder fails in searching for the import for func1() in
service program SP1, which has not been created in
the previous step.
If you try and create program
A with the compiler
invocation: CRTPGM PGM(A) MODULE(MYLIB/M1) BNDSRVPGM(MYLIB/SP1 MYLIB/SP2)the
binder fails, because service programs SP1 and SP2 do
not exist.