HP Fortran Programmer's Guide (March 2010)

Migrating to HP Fortran
Approaches to migration
Chapter 10 241
Approaches to migration
The most direct (and painstaking) approach to migrating an HP FORTRAN 77 program so
that it will compile and execute correctly under HP Fortran is to make a clean sweep through
the original source code, removing all extensions and rewriting all nonstandard programming
practices to conform to the Fortran 90 standard. The result will be a highly portable program.
The disadvantage of the “clean-sweep” approach is that it may require a considerable expense
of time and work that may not even be necessary. Many HP FORTRAN 77 extensions are also
supported under HP Fortran. The only changes that you must make to the source are to
remove or re-code the parts of the program that use unsupported or incompatible language
extensions.
Although the task of migrating an HP FORTRAN 77 program to HP Fortran can be done
manually, there are several utilities that can help to automate the search for
incompatibilities. These utilities (including sources of information about migrating to
Fortran 90) are described in the following sections.
HP-supplied migration tools
The HP migration tools include the HP FORTRAN 77 and HP Fortran compilers (f77 and
f90), lintfor, and fid.
HP FORTRAN 77 compiler
You can use the f77 command to test source code for conformance to the FORTRAN 77
standard. The -A option causes the compiler to issue warnings when it encounters non-ANSI
code.
If you use f77 for this purpose, the source code must conform to the FORTRAN 77 grammar.
In other words, f77 will flag both HP-specific extensions as well as language features that are
unique to Fortran 90. If the source code contains any Fortran 90 features (some of which are
allowed in HP FORTRAN 77 but not in standard FORTRAN 77) or if you introduce any
Fortran 90 features during the migration process, the f77 command is no longer useful.
HP Fortran compiler
The f90 command can be used similarly to the f77 command to detect incompatibilities in
HP FORTRAN 77 source files. The advantage of f90 over f77 is that you can use it on code
that already contains Fortran 90 features or to which you are incrementally adding such
features as part of the migration process.