Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

How to compile FORTRAN77

riceman0
Beginner
1,178 Views
Hi, we have some venerable, reliable fortran code that we have been using for so long that the current compiled version doesn't run on windows machines. We need to recompile it for modern machines, so we purchased the Intel Fortran compiler a while ago. We are just getting around to using it, and I see that it embedded itself into my .NET 2003, which is good. I started a Fortran project, and incorporated our .F source file into it, and it doesn't compile. It seems that it expects Fortran 90 (?), and doesn't like:


a) the C in the first column indicating comment

b) an arbitrary character in the column 6 indicating continued line

c) the statement OPEN(9, FILE='CON') which previously opened a stream to console/screen

The Intel fortran compiler says it supports fortran 77, does that mean that there is an option I can set that will allow it to interpret my file as fortran 77 code, and treat these as legal statements?

I'd rather not update the code itself if I can help it, as that introduces the risk of translation errors...

0 Kudos
4 Replies
TimP
Honored Contributor III
1,178 Views
If your source files are named with .for or .f (or same thing in upper case), ifort defaults to the old fixed form 72 column format. Otherwise, you may need to add the -4L72 (or 80 or 132 for extended source lines).
I'm sure you will get additional advice about opening the console. If you were sticking to f77 here, you would simply use the * device to communicate with the console, without using OPEN, and that would work the same with f95 compilers.
0 Kudos
Steven_L_Intel1
Employee
1,178 Views
You should not need to do anything special. My guess is that you have renamed your .f files to be .f90. If you rename them back to .f then they will be treated as fixed-form source in the manner of F77.

The OPEN (FILE='CON') does not need to be changed.
0 Kudos
riceman0
Beginner
1,178 Views
Fantastic, thanks! Changing the file extension did the trick!

I did have to change out a DATE and TIME function call with a DATE_AND_TIME call... funny, I thought I was told that it only used intrinsic functions...

However, the program now runs but still can't seem to recognize the CON in

OPEN(9,FILE='CON')

as a special symbol, I get an error saying it can't find the file 'CON'. Would that be compiler specific? Is it the 9 that is throwing it off?

0 Kudos
Steven_L_Intel1
Employee
1,178 Views
I did an experiment with FILE='CON' and unit 9 and it worked. You could also try 'CONOUT$' (or CONIN$ if you are reading). Units 5 (for read) and 6 (for write) are preconnected to the console.

DATE and TIME are not standard intrinsics.
0 Kudos
Reply