A general rule for resurrecting old code in any language is first try to get it working for known input/output via emulation or virtual machine. Many old codes were made before linters and other correctness checks we’ve long taken for granted. The codes may use non-standard tricks no one has thought about for years to squeeze tiny fractions of efficiency that haven’t been significant for decades.
After correct operation is established, Fortran 66 code often needs a few tweaks to work with modern compilers.
The Fortran Wiki has an excellent article on modernizing Fortran syntax
Here are a few specific techniques we use.
Obviously make a copy of the file first. Sometimes 10,000+ lines will match so it can be tedious to check. Similar operations may be needed if a mix of tabs and spaces are used.
move line numbers left
Run this regex and replace with null (nothing):
make code start in column 7
Recall that fixed format (Fortran <= 77) code has line numbers in columns 1-5 of each line numbers After the prior operation, push the actual code right of column 6 by replacing this regex with appropriate number of spaces:
You may see
$ used like a semicolon in CDC Cyber Fortran
Duplicated line numbers
Put procedures in separate files for duplicated line numbers.