COBOL Manual for TNS and TNS/R Programs
Issues Related to Binding and Linking
HP COBOL Manual for TNS and TNS/R Programs—522555-006
24-20
TNS User Library
You can compile an HP COBOL routine with the ENV LIBRARY directive and put it into
the user library if the program satisfies these criteria:
•
It is not a main program.
•
It is an initial program (its PROGRAM-ID paragraph specifies INITIAL).
•
It is a separately compiled program (it is not embedded in another program).
•
It does not contain any other programs.
•
It does not specify the GLOBAL phrase on any level-01 record descriptions.
•
It does not reference any external data items or external files.
•
It does not have an Extended-Storage Section.
•
It does not have a PROGRAM COLLATING SEQUENCE clause.
If a routine does not meet the preceding criteria and you try to compile it with the ENV
LIBRARY directive, the compiler issues a diagnostic message.
If you compile a routine with the ENV LIBRARY directive:
•
ASSIGN and PARAM commands for the files in the routine are ignored.
•
The compiler does not create data blocks or references to data blocks for the
routine. Instead, the operating environment creates these at run time. The routine
requires more time to start when called and might execute slightly more slowly.
•
The routine, which executes in user library space, cannot call routines that execute
in user code space.
Best Candidates for the TNS User Library
Of the routines that you can place in the TNS user library (see Routines That Can Be
Placed in the TNS User Library), the best candidates are the routines that many
programs share. Putting commonly used routines in the TNS user library packages
them neatly and can reduce the storage space required for object code on disk and in
main memory.
Putting Routines in the TNS User Library
To put routines in TNS user library space:
1. Put the source code for the routines in a file.
2. Compile the file of routines with the directive ENV LIBRARY.
3. Either make the resulting object file the user library (see Making an Object File the
User Library), or use BIND to bind the resulting object file to the existing TNS user
library (see the Binder Manual).