Question:
Compiling FORTRAN IV or convert to a more structured FORTRAN like FORTRAN 77?
abinet l
2011-06-08 18:10:31 UTC
I'm not a programming guy, but I've got some code I need to run, written in FORTRAN IV. What are my options for running this code? Is there a reasonably priced or free application out there that can compile and run FORTRAN IV code on a PC? If possible I am looking for a utility to convert Fortran IV code to a more structured sort of FORTRAN like FORTRAN 77 or later.
Thanks.
Five answers:
husoski
2011-06-08 20:22:53 UTC
Fortran IV will present a few problems. The first is the language, though most everything in Fortran IV should still work in Fortran 77, and the GNU Fortran compiler will compile that. More of a problem is dependence on system unit numbers for input and output, character sets (an awful lot of Fortran IV was done on IBM S/360, S/370 and S/390 computers using an EBCDIC character set. Collating order is different for sorts, and there are pesky characters like the cent sign and the ledge-shaped logical NOT symbol that ANSI never thought worth adding. They won't be in the language, but may be in alphanumeric constants and data.



I'd suggest feeding the source to GNU Fortran first and seeing if the number of error messages is worth trying to fix.



@RatchetR: Not only are my parents older than "that", but the first compiled language I learned was...FORTRAN IV. With an IBM 029 keypunch as my programming editor.



Edit: If you are using Windows, the two main choices for ports of the GNU Compilers are MinGW ("Minimalist GNU for WIndows"), or Cygwin. Cygwin is more fun to use (IMHO), but MinGW binaries are a bit easier to distribute, since MinGW generates native Win32 code. Cygwin binaries run in an emulated Unix-like environment and need an extra DLL to provide that.



Like the earlier answerer, I haven't tried these, but both NetBeans and Eclipse offer support for Fortran projects using the GNU compilers. Each can work with either MinGW or Cygwin ports of the compilers. The Eclipse plugin ("Photran") advertises a refactoring editor. If that's not just noise, it could make finding and changing oddities easier.



These tools also work under Linux, OSX and other Unix-likes. For that environment, there's also the Oracle Sun Solaris Studio.
Shadow Wolf
2011-06-08 20:20:50 UTC
DJGPP and RHIDE is capable of compiling at least the newer Fortran standards depending on flags. Keep in mind this creates 32 bit apps with a 16 bit stub so you need Dosbox or a similar emulator to run them under Win64. Also, DJGPP and RHIDE are not very user friendly if you are unfamiliar with DOS and setting everything up for use under DOS. Under WinXP, Vista and Win7 you'll be running in a command window if 32 bit or Dosbox or XP mode if you are 64 bit.



With Fortran, I usually just translate it to QBasic or C. The majority of programs are small enough that this isn't a huge task. I would have thought most of the useful Fortran code was translated to something more modern by now. Did you happen to try Google and see if there wasn't an equivalent available?



I hope you have the programs on a PC and you can at least read them. Some of that could be on punch cards or paper tape.



Shadow Wolf
Vincent G
2011-06-08 20:09:16 UTC
There are relatively few things that we dropped between Fortran IV and Fortran 77.

Basically, you need to watch for those Hollerith constants (which need to be replaced by the CHARACTER type -- but it is possible that your code does not even have them as they became popular with Fortran 66) and the GOTO (calculated GOTO's, and jumping from outside of a DO loop).



Depending on the size of the code, a conversion to F77 standard should be relatively an easy task for someone who knows his way in Fortran. I am not aware of any automated conversion, and one is unlikely to exist, Fortran IV goes back 45 years, so any active code would have been progressively adapted and converted, making the need for the development of an utility something that could not have been seen before.
Ratchetr
2011-06-08 19:31:43 UTC
I have no answer for you. But interesting question.



I suspect you will have little luck at this unless you find a programmer that has actually done this sort of conversion. Check a local nursing home.



The time frame here is almost mind boggling.



Fortran IV was first released in 1962. 49 Years ago. Are your parents that old?



Fortran 77 came out in...surprise... 1977. 34 years ago. Your parents could easily be younger than that.



There have been a number of releases of Fortran since then, the last being 2008. You might have kids that are younger than that.



I suspect there were tools at one time to do this sort of conversion. But they probably don't run on any OS you own, or could own today.



Which takes me back to my original statement that you need to find someone who had at least been born back then, and let them apply their knowledge to doing a conversion. Expensive would be my guess.



Or, you find someone who can at least read that code, understand what it does, and have them rewrite it in a modern programming language. ( Fortran 2008 wouldn't be my first choice, but it might be the shortest path). Again...probably expensive.



If you do find a magic bullet solution to this...send me an email and tell me what it was. I always find it interesting when old code resurfaces after decades, and how people solve the problem.



Also: You might try asking this on Stack Overflow (second link). You are more likely to find people who have actually been there...done that than you will ever find on YA! But it's still a long shot, I suspect.
ResourceGuy
2011-06-08 18:20:21 UTC
I haven't tried it personally but Netbeans IDE contains an addon for Fortran. It is all free.



I installed the fortan addon but only use the c/c++ part of it. If you decide on installing netbeans, i recommond the install that bundles netbeans with java. I tried to install java and then install netbeans but had issues, the bundled install was far easier. You might need to install cygwin too, but there are a lot of uses for this install. If you have problems, join the nbusers forum and ask/search for help there...

good luck.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...