If you are using FORTRAN for coding, download and take a look @ Fortran Refactoring for Legacy Systems
Also, while you code, have in mind the followings:
Common FORTRAN-isms I deal with, that hurt readability are:
- Common blocks
- Implicit variables
- Two or three DO loops with shared CONTINUE statements
- GOTO’s in place of DO loops
- Arithmetic IF statements
- Computed GOTO’s
- Equivalence REAL/INTEGER/other in some common block
Strategies for solving these involve:
- Get Spag / plusFORT, worth the money, it solves a lot of them automatically and Bug-Free(tm).
- Avoid fixed format Fortran 77. Move to Fortran 90, if not move to free-format Fortran 77. (2003 standard is out there. check the updates…)
- Add IMPLICIT NONE to each subroutine and then fix every compile error, time-consuming but ultimately necessary, some programs can do this for you automatically (or you can script it).
- Moving all COMMON blocks to MODULEs, low hanging fruit, worth it.
- Convert arithmetic IF statements to IF..ELSEIF..ELSE blocks.
- Convert computed GOTOs to SELECT CASE blocks.
- Convert all DO loops to the newer F90 syntax.
myloop: do ii = 1, nloops ! do something
- Convert equivalenced common block members to either ALLOCATABLE memory allocated in a module, or to their true character routines if it is Hollerith being stored in a REAL.