One standard debugging technique is to print out the values of
variables and constants from different parts of your program to check
that they are being transferred correctly. Another debugging technique
is to build a simple test case right into your program and then to
check that it continues to give a known answer even after
you make those ``harmless'' modifications. Once these debugging
structures are built into your program, you just leave them there
permanently-without having to execute them. You do that by
commenting them out with a d or D in column 1. For
example:
subroutine sub1 d write(6,999) 'at 999, x, y =', x, y d in col. 1. d 999 format( (a), 2f10.3) d in col. 1.
If this is done with the traditional C in column 1, you must go back and modify the source code to
uncomment them. With a d in column 1 you uncomment these
statements by invoking the D (for debugging) option of the Fortran
compiler:
% f77 -D sub1.f Option makes D statements = source.
Or alternatively, you may place debug directives in
the source file:
$debug on Treat D statements as source. $debug off Treat D statements as comments.