top_left_banner  SimCon logo


Migrating/Porting Fortran from VMS

You have half a million lines of VMS Fortran which has to go to Linux, Unix or Windows. A trial compilation on the new host was disastrous. What are the problems, and how can you deal with them?

What are the Problems?

The issues in migrating from VMS are:

  1. Syntactic Differences: where VMS Fortran simply uses a different syntax from standard Fortran for the same construct.
  2. Language Extensions: where VMS Fortran supports facilities which are not supported at all by modern compilers.
  3. Semantic Differences: where a VMS Fortran statement has the same syntax as a standard Fortran statement, but compiles with a different meaning.
  4. The VMS System Libraries: The system library routines used in a program must be emulated. Often the call-sites must be modified to change the way in which the arguments are passed.

The syntactic and semantic differences are all handled automatically by fpt. The VMS system libraries, and many of the language extensions are handled by Sector7's VMS emulation libraries. These libraries provide a very complete emulation of VMS under Linux or Unix.

Assessing Your Code

The list of potential problems shown below is alarming. But all of the language issues can be dealt with by fpt and all of the VMS library routines can be supplied by Sector7. To assess the code, build an fpt project as described here (Contact SimCon to arrange a temporary licence for this for which there is no charge).

The important decisions are:

Issues in VMS Fortran Migration

Syntactic Differences

These are cases where VMS simply uses a different syntax for a construct which is supported in standard Fortran. The problem is that the code will simply not compile on the new host. All known issues are fixed automatically by fpt. The important cases include:

There are other, less common syntactic problems, for example, direct access record specifications of the form READ(iunit'irec) or $ used instead of * for label formal arguments. All known cases are translated by fpt.

Features which are Not Supported by the New Host

These are language constructs which are supported by VMS for which there are no simple syntactic translations to modern Fortran. The code must be re-structured. Usually, sub-programs must be called to supply the missing features.

Again, the VMS code will simply not compile or run without modification. The important issues are:

Semantic Differences - Statements which Compile Differently

These are are constructs which compile under VMS but compile with a different meaning on the new host. They are faux amis. They compile. They look correct, but they don't behave as you might expect. They cause the worst kind of error - an unpredictable failure ar tun-time.

The VMS System Libraries

The VMS system libraries contain many hundreds of routines which handle issues such as inter-process communication and timing, logical name handling and specialised text and form manipulation. Sector7 Inc. has developed a very complete emulation of these libraries for Linux and Unix. Sector7's libraries also provide support for the language features in VMS Fortran which are not supported by modern compilers, in particular for ISAM files.

It is important to understand how complex this emulation needs to be. The system must maintain tables which support VMS file names, including file version handling and logical name translations, and these tables must be visible to all programs which use the emulations. Similarly, VMS event flags and mailboxes must be emulated and shared in the same way as under VMS. The system must also contain a complete emulation of DCL.

The VMS system libraries are shared by all of the computer languages supported under VMS: they are not specific to Fortran. In consequence, the arguments to the library routines are sometimes passed in ways which differ from the usual Fortran defaults. Under VMS, the argument passing protocols may be specified by the pseudo-intrinsics %REF, %VAL, %LOC and %DESCR. These, and other attributes of the call-sites must be modified systematically by fpt to conform to the requirements of the target compiler. The issue is described here.

Copyright ©1995 to 2017 Software Validation Ltd. All rights reserved.