FORTRAN Reference Manual
Program Compilation
FORTRAN Reference Manual—528615-001
9-25
User Library Alternatives for Utility Subprograms
User Library Alternatives for Utility 
Subprograms
The user library feature of the operating system is a convenient way to make packages 
of general-utility subprograms available to multiple application programs. Alternative 
methods are:
•
Use the SEARCH directive when you compile the application programs, causing 
each application program’s object file to include its own copy of the utility 
subprograms that it needs. The disadvantages with SEARCH are that the 
application program object files are larger than they should be, and bug fixes and 
other improvements to the utility subprograms are not propagated into all of 
application programs unless they are re-compiled or at least re-bound.
•
Use SYSGEN to incorporate the subprogram package into the system library code 
space. The disadvantage with SYSGEN is that you must request your system 
manager to do this.
For more information on libraries, see the LIBRARY compiler directive in Section 10, 
Compiler Directives, and the FORTRAN RUN command in Section 11, Running and 
Debugging Programs.
Sample Programs Using the Search Directive
This section contains two sample programs. One shows development of a program 
using SEARCH and SOURCE directives for subprograms. It also includes an 
alternative development cycle using the interactive Binder.
The second program uses SEARCH to select certain subroutines from an object file of 
subroutines, some of which also contain subprogram calls. (The calls can be recursive 
or call other subroutines.) It shows how different users can use a subroutine object file 
as a common resource.
Using the SEARCH Directive—Sample Program 1
This sample program transposes the rows and columns of a five-row, five-column 
matrix named ARRAY. The steps in the development of the program are flexible. That 
is, coding and compilation can take place in different sequences. However, use of the 
SEARCH directive is effective only if compiled code is available to satisfy external 
references; this implies that you cannot use SEARCH from a subprogram for a main 
program unit.
1. Code and compile separately a subroutine subprogram that is named 
PRINTARRAY. The resulting code and data blocks are in an object file named 
PRINTO. (The source file name is PRINTS.)
2. Code a dummy for the transpose subroutine, TRANSPOSE. The source file name 
is DUMMYS. The dummy subroutine allows program testing to occur in stages.










