Fortran 90 Guide

Migration to Fortran 90

Writing Better Fortran 90 Programs

FAQ Lists


Ask the CISL Consultants

Fortran 90 Welcome .
Guide to Fortran 90
maintained by
NCAR/CISL Consulting Services Group

Introduction

The Fortran 90 programming language is an international standard as well as a national standard. It is a superset of the ANSI Fortran 77 programming language standard. The purpose of this guide is to assist you in migrating to Fortran 90 compilers and to help you begin using the new features of Fortran 90.

A Few Things to Remember

  • Fortran 77 is a subset of Fortran 90. While there are many new language features in Fortran 90, your programs aren't required to use them. All ANSI Standard Fortran 77 programs should compile without changes; however, there can be minor differences in the case of language extensions, and compiler implementation. Also, within the Fortran 90 standard itself, there are new intrinsic functions that may have the same name as a user-supplied routine.

    Note that if you have been using Fortran 90-like extensions under Cray's CF77 compiling system, your code may not be portable as Standard Fortran 90.

  • Careful testing is your best assurance against introducing new errors through the transition. Test the code as you make changes to the source and when you switch compilers. For code that is to be portable, try to test on more than one Fortran 90 compiler.

  • The CISL Consulting Services Group will be available to assist you.

Our Recommended Model for Switching to Fortran 90

  • Make backup versions of your source code as you go through the conversion process.

  • Validate the syntax and consistency of your Fortran 77 source code before you start. While this may sound unnecessary, the CISL Consulting Services Group has found that many problems in the conversion process can be avoided entirely by starting with clean source code. Tools available to help you in the process include:

    • FLINT, a Fortran 77 syntax and consistency checker (use the "-a" option)

    • The Fortran 77 compiler with the ANSI option enabled

    • VAST/77to90, a commercial conversion tool from Pacific-Sierra, is available on windom.ucar.edu. It is accessible via the v77to90 command. This command converts f77 code to f90. For example:

        v77to90 a.f # Creates file Va.f90

      The command is located under /fs/local/bin on windom. Please type "man v77to90" for details and options.

    • convert.f90, a free program from CERN, can be used to perform simple conversions.

  • Compile the code with the Fortran90 compiler. If any compiler warnings or errors are produced, fix them before continuing.

  • If you are satisfied with the results, you are, for all intents and purposes, finished with the conversion process at this point. The remaining steps are optional.

  • At this point you may wish to consider putting the compilation and linking of your code under the control of the UNIX "make" utility. This allows incremental builds of your program by recompiling only those modules which have changed since the last build.

  • Use a Fortran77-to-Fortran90 converter on your code to help remove obsolescent language features and transition to the new source form. This step is optional because all Fortran 90 compilers will accept obsolescent language and the old "fixed" source format.

  • The above (optional) conversion from Fortran 77 to Fortran 90 may or may not make extensive use of new language features. If you wish to use the new features of the Fortran 90 language, this is the time to begin implementing them.

The Computational and Information Systems Laboratory is a division of the National Center For Atmospheric Research, which is sponsored by the National Science Foundation, and operated by the University Corporation for Atmospheric Research.