You can also change the order of program creation to avoid unresolved references, by first creating a service program with all modules, and then re-creating this same service program later.
RTVBNDSRC MODULE(MYLIB/M2 MYLIB/M3) SRCFILE(MYLIB/QSRVSRC) SRCMBR(BNDLANG3)
This command results in the binder language shown in Figure 20 being created in library MYLIB, source file QSRVSRC, file member BNDLANG3.
CRTSRVPGM SRVPGM(MYLIB/SP1) MODULE(MYLIB/M2 MYLIB/M3) SRCFILE(MYLIB/QSRVSRC) SRCMBR(BNDLANG3)
Because modules M2 and M3 are specified, all import requests are resolved and service program SP1 is created successfully.
CRTSRVPGM SRVPGM(MYLIB/SP2) MODULE(MYLIB/M3) SRCFILE(MYLIB/QSRVSRC) SRCMBR(BNDLANG2) BNDSRVPGM(MYLIB/SP1)
Because service program SP1 exists, the binder resolves all the import requests required and service program SP2 is created successfully.
CRTSRVPGM SRVPGM(MYLIB/SP1) MODULE(MYLIB/M2) SRCFILE(MYLIB/QSRVSRC) SRCMBR(BNDLANG1) BNDSRVPGM(MYLIB/SP2)
Although service program SP1 does exist, the import request for func2() is not resolved to the one in service program SP2. Therefore, a re-creation of service program SP1 is necessary to make the circular reference work.
Because service program SP2 now exists, the binder can resolve the import request for func2() from service program SP2, and service program SP1 is successfully created.
CRTPGM PGM(MYLIB/A) MODULE(MYLIB/M1) BNDSRVPGM(MYLIB/SP1 MYLIB/SP2)
Because service programs SP1 and SP2 do exist, the binder creates program A.
Figure 20. Binder Language for Service Program SP1
+--------------------------------------------------------------------------------+ | Columns . . . : 1 71 Browse MYLIB/QSRVSRC | | SEU==> BNDLANG3 | | FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 | | *************** Beginning of data ************************************ | |0000.01 STRPGMEXP PGMLVL(*CURRENT) | |0000.02 /********************************************************************/ | |0000.03 /* *MODULE M2 MYLIB 95/06/11 18:50:23 */ | |0000.04 /********************************************************************/ | |0000.05 EXPORT SYMBOL("func1__Fi") | |0000.06 /********************************************************************/ | |0000.07 /* *MODULE M3 MYLIB 95/06/11 18:50:23 */ | |0000.08 /********************************************************************/ | |0000.09 EXPORT SYMBOL("func2__Fi") | |0000.10 ENDPGMEXP | | ****************** End of data ************************************** | | | +--------------------------------------------------------------------------------+ |
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.