FORTRAN Reference Manual
Program Compilation
FORTRAN Reference Manual—528615-001
9-29
Using the SEARCH Directive—Sample Program 1
C This is the real transpose subroutine.
 SUBROUTINE transpose
?SOURCE global
INTEGER temp, i, j
DO 20 i = 2, asize
 DO 10 j = 1, i-1
temp = array(j, i)
array(j, i) = array(i, j)
array(i, j) = temp
10 CONTINUE
20 CONTINUE
 RETURN
 END
Step 5—Version One —Program Test
Run the program. The output produced begins with zero (rather than one) as the first 
subscript value. You must change the calculation in the main program to get the 
planned results.
The work on TRANSPOSE is not dependent on the calculations in the main program; 
therefore, you can code it concurrently with the development and testing of other 
program units.
Step 6—Main Program, Version Two
The source file for MAIN is altered for the required calculation. Instruct BINSERV to 
purge the old object file and use the same file name for the target file. (The FORTRAN 
implied run command has the same effect as when the compiler built object files.) 
The source file includes a SOURCE directive for the actual TRANSPOSE subroutine. 
FORTRAN compiles the code and passes it to BINSERV. Since BINSERV has a code 
block named TRANSPOSE for the target file (from the compiler), there is no external 
reference to TRANSPOSE remaining when BINSERV executes the SEARCH directive. 
Therefore, the dummy TRANSPOSE is ignored.
Since no data was changed, there is no need to recompile PRINTARRAY.










