abnet
abnet

Reputation: 31

Compiling FORTRAN IV or convert to FORTRAN 77?

I've got some code I need to run, written in FORTRAN IV. What are my options for running this code? Is there an application out there that can compile and run FORTRAN IV code on a PC? Or if possible I am looking for a utility to convert Fortran IV code to FORTRAN 77 or later. I have little experience in Fortran and in programing in general. Thanks for you help

Upvotes: 3

Views: 4286

Answers (5)

Try This
Try This

Reputation: 21

The obvious answer is to run it as is on MVS 3.8J under the Hercules emulator. MVS 3.8J and IBM FORTRAN G and FORTRAN H are public domain.

You will be able to compile and run the code as if you had a real mainframe! The IBM FORTRAN compilers support (defined, actually) the full FORTRAN IV language along with IBM extensions.

Upvotes: 2

Kurt Glaesemann
Kurt Glaesemann

Reputation: 91

Probably the most important feature of Fortran IV is that do loops check the variable at the end. Thus do loops always execute at least once. This was a big issue when it was changed to the current method.

    n = 5
    do 99 i = n, 4
     write(*,*) i
99  continue

Will print out "5" in Fortran IV, and nothing in Fortran 77. Codes that use this feature can be hard to port.

Upvotes: 3

Jonathan Dursi
Jonathan Dursi

Reputation: 50927

I'll just add that if the code does use non-standard features that your compiler doesn't handle, the maintainers at fortranwiki.org maintain a nice list of explanations of, and workarounds for, many such contstructs on their Modernizing Old Fortran page.

Upvotes: 2

M. S. B.
M. S. B.

Reputation: 29391

Very few features have been deleted from Fortran. A few more features have been marked as obsolescent in the more recent language standards. But the compilers tend to support most or all of these features because some customers don't want to recode working legacy programs just because they use "bad" features. Sometimes one has to use compiler options to use some of these features. So I'd just pick a compiler and try it on the existing code. There are many to choose from. Maybe get a trial version to see whether it works before paying your money or use a free one.

Another possible problem is that your code base might have non-standard features. In pre Fortran-90 days there was less concern with language standards and some vendors added extra features for user convenience and to differentiate their product. If present, such features might cause greater problems and require recoding.

Upvotes: 5

JasonFruit
JasonFruit

Reputation: 7875

Intel's Fortran compiler supports Fortran IV. If you don't want to go that way, there are some conversion utilities mentioned in this question --- but none of them sound very promising.

Upvotes: 5

Related Questions