Fortran IV Program update to Fortan 77
Fortran IV Program update to Fortan 77
(OP)
I have an old Fortran IV program that I want to update to a more modern format. Does anyone know if the Fortran IV code can be compiled to a new Fortran? Does anyone know of any compilers that can do this?
RE: Fortran IV Program update to Fortan 77
Needless to say, I would totally go through the code with a fine tooth comb and modernize the entire code...that's the best thing to do.
Back then, they would do some scary things, like saving strings into REALs, pass arrays to scalars into a subruotine, some other Hollerith character stuff that nobody does anymore, etc. etc. etc.
You (or somebody) really needs to go through this code and consciously modernize it. I have done it...it is not sooooo bad, you just need to keep an eye for certain things. Soon enough, you will get an idea of the habits of the original programer and start finding his/her design pattern over and over.
my 2 cents
RE: Fortran IV Program update to Fortan 77
You may need to add a PROGRAM statement to the main program. Other than that it, if there is nothing fancy, it should just build in F77. The things you need to watch out for are
- F77 doesn't remember values on re-entry. If the values need to be remembered, they have to be SAVEd. There may be a compile flag to get around this.
- the use of hollerith constants. If, say, it was written for a CDC7600 with 6 bit characters and 60 bit words, and a lot of character assignments were done; those will need changing
- Use of assign for formats and assigned gotos. The newer compilers no longer allow assign so that will have to be recoded as a case statement.
Many of the programs I wrote wouldn't even build because I used to use all the little known features and vendor specific stuff that hardly anyone used. But that was my fault. Normal programs will just build and without any problems.If you want something more funky like F90, F95, F03 or F08, that is a different ball game since lots of things have been removed and a whole new load of stuff has been added but there is nothing to stop you from writing F08 like F66! As the saying goes: you can write Fortran in any language.
RE: Fortran IV Program update to Fortan 77