Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update from Fortran IV to Fortran 77

I have received an consulting assignment where I will update a Fortran IV program to Fortran 77. The problem is that I never coded in Fortran. Can you give me tips on where I can learn Fortran and what is the difference between the Fortran IV and 77?

Edit

The program to be updated is running on a MODCOMP 9250 (See pictures here) The program was developed on the original compiler. The compiler was updated to Fortran 77 around 1990. My clients want to do some modifications to the application and want to take this opportunity to update the code to the latest compiler

like image 900
magol Avatar asked Dec 09 '22 11:12

magol


2 Answers

This seems a really bizarre assignment ... is the purpose to teach that programming languages have improved over the decades? If so, why not translate into a modern language, such as Fortran 95?

While I occasionally encounter legacy FORTRAN 77 code, it has been a very long time since I worked with true FORTRAN IV -- it is hard to remember the differences. I think that the biggest was improved IF statements, that made it easier to write clearer code. A list of the changes appears at http://en.wikipedia.org/wiki/Fortran

If you are using gfortran, the following options should compile a FORTRAN 77 program:

gfortran -ffixed-form  -ffixed-line-length-none  -W  -Wall -pedantic -o my_prog.exe   my_prog.for
like image 122
M. S. B. Avatar answered Jan 09 '23 11:01

M. S. B.


The best place for checking the differences between the two is the fortran standards drafts (latest drafts are practically identical to the published standards; only they're free for download).

For example, f77 standard.

The problem however is that in the time of fIV standards were not so followed, and almost all (I can even safely say all) compilers included a variety of vendor extensions, of which some are surely found in your program as well. So, take a compiler manual, if you have one, as well.

The process of "updating to f77" (Gawd, I never thought I would say that - "updating to f77") would for you, be best to go in a way.
a) take a fortran short tutorial somewhere (a lot of them on the internet); just to see what fortran looks like
b) once you start recognizing program elements and structures, you can start translating it. Probability is that you will have to translate a lot of TYPE (depends) to WRITE or PRINT, modify some IF statements, modify some file input/output operations, you'll probably also encounter some COMMONs, with which you can have more or less problems, ... in any case, try, and when get stuck, post here.

How big is your assignment?

p.s. As I said in some comment above, chances are the program you're translating isn't really fIV but a mixture of fIV, f66/77, maybe even some elements of f90 - but your professor/person giving the assignment isn't aware of the difference. Unless you just copied it from an old data tape. I used to see such examples all the time.

like image 32
Rook Avatar answered Jan 09 '23 12:01

Rook