Using the LIBRARY statement
Use the LIBRARY statement to direct the binder to search a library other than that specified in the SYSLIB DD statement. This method resolves only external references listed on the LIBRARY statement. All other unresolved external references are resolved from the library in the SYSLIB DD statement.
In Figure 1 the LIBRARY statement is used to resolve the external reference PROGRAM2 from the library described in the TESTLIB DD statement.
Figure 1. Using the
LIBRARY linkage editor control statement
//SYSLIN DD DSNAME=USER.OBJLIB(PROGRAM1),DISP=SHR
// DD DDNAME=SYSIN
//TESTLIB DD DSNAME=USER.TESTLIB,DISP=SHR
//SYSIN DD *
LIBRARY TESTLIB(PROGRAM2)⋮
/*
Data sets specified by the INCLUDE statement are incorporated as the linkage editor encounters the statement. In contrast, data sets specified by the LIBRARY statement are used only when there are unresolved references after all the other input is processed.