FORTRAN Reference Manual

Program Compilation
FORTRAN Reference Manual528615-001
9-26
Using the SEARCH Directive—Sample Program 1
3. Code and compile the main program unit. The source file includes a SOURCE
directive for the DUMMYS file. A SEARCH directive identifying PRINTO as the
search list is included to have BINSERV include the object code from Step 1 in the
program file. The program file is named MAKEONE. It contains copies of the
MAIN^, PRINTARRAY, and TRANSPOSE dummy code.
4. Test run the program produced in Step 3. (This step is completely independent of
Step 5.)
5. Code the actual transpose subroutine, TRANSPOSE. The source file is named
XPOSE.
6. Based on the output of Step 5, alter the source code for the main routine. Include a
SOURCE directive for XPOSE (for the actual transpose subroutine). Include a
SEARCH directive identifying MAKEONE (to get the code and data blocks for
PRINTARRAY). Recompile the main routine, deleting the old MAIN file. (The new
version MAIN^ object code will then be in a file named MAIN.) The program file is
named MAKETWO.
Each program unit that declares ARRAY uses the source file GLOBAL for the
declarations. (The SOURCE directive for GLOBAL is part of each source file except
the dummy for the TRANSPOSE code.) GLOBAL contains these declarations for
ARRAY:
INTEGER array, asize
PARAMETER (asize = 5)
COMMON /array/ array (asize, asize)
Following are source listings for the program.
Step 1—PRINTARRAY Subprogram
Compilation of this source file results in an object file that contains a code block named
PRINTARRAY (the name on the SUBROUTINE statement). The object file has the
following data blocks: #FLUT, #G0, #LOWBUF, #PUCB, #RUCB, ARRAY and
COMMON#POINTERS. #G0 contains a pointer to #RUCB. (FORTRAN allocates no
storage for the local variables in the object file. It allocates this storage at execution
time.)