COBOL Manual for TNS and TNS/R Programs

Libraries and Utility Routines
HP COBOL Manual for TNS and TNS/R Programs522555-006
13-10
Building a User Library
Building a User Library
A program can be put in a user library if:
It is not a main program.
It does not contain embedded SQL/MP or SQL/MX statements.
It does not contain external objects (data or files that are to be shared with code
that is outside the library).
From a Single Source File
To build a user library from a single source file (which can contain one or more source
programs), compile the source file with these directives:
RUNNABLE
UL
The resulting loadfile is a user library. If you use this method of building a user library,
each object file that is to be included in the library must be referenced with either a
file-mnemonic (see CALL and ENTER) or a SEARCH directive (see SEARCH and
NOSEARCH) so that the compiler can find it.
From Multiple Source Files
To build a user library from multiple source files (each of which can contain one or
more source programs), compile each source file with the UL directive but without the
RUNNABLE directive. Link the resulting linkfiles, using the linker with the -ul flag. The
-ul flag causes the linker to link the object files into a single loadfile, which is a user
library.
Specifying a User Library
At compilation time, you must specify the user library that you want your program to
use in a CONSULT directive (see CONSULT and NOCONSULT). At run time, you must
specify the same user library by using the LIB option of the RUN command (in the
Guardian environment) or the -lib flag of the run command (in the OSS
environment).
Note. ASSIGN and PARAM commands for files in a user library are ignored.