Operating System - HP-UX
1833771 Members
2346 Online
110063 Solutions
New Discussion

g77 or f77 for HPUX as part of a migration effort from another platform?

 
Justin Masters_1
Occasional Contributor

g77 or f77 for HPUX as part of a migration effort from another platform?

I asked a question about g77 for an 11.11 system in another message, but I want to ask a more generic question and ask for help in understanding the scope of what I'm facing.

We've run a few decades of R&D efforts on the backs of fortran code - most recently on an SGI platform (IRIX). Most of our machines are gone, and the rest are slowly dying.

The big task (which hasn't been adequately addressed with any action) as been to port this code to another platform (HPUX 11.x).

We have 1-2 machines with purchased f77 software on the HP platform, but I was interested in exploring g77 as well.

I'm by no means a fortran expert - never programmed in it before - but as I installed a g77 copy on an HP 11.00 system and tried to compile a basic program, I find such errors as below:

g77 -o foo foo.f
foo.f: In program `MAIN__':
foo.f:10:
OPEN(UNIT=7,
^
Unsupported OPEN control item at (^) -- ACTION=, ASSOCIATEVARIABLE=, BLOCKSIZE=, BUFFERCOUNT=, CARRIAGECONTROL=, DEFAULTFILE=, DELIM=, DISPOSE=, EXTENDSIZE=, INITIALSIZE=, KEY=, MAXREC=, NOSPANBLOCKS, ORGANIZATION=, PAD=, POSITION=, READONLY=, RECORDTYPE=, SHARED=, and USEROPEN= are not supported

Part of me is thinking that an OPEN command is a basic part of any programming language, yet g77 is choking on it. The code up to that point is seen below:

C This code reads a .OUT xxxxx file to obtain yyyyyyy,
C and zzzzzz. It then writes an
C ASCII file that can be used with gnuplot to generate
C 3D plots of zzzzzzzzzzzzz versus r and z.
C
DIMENSION R(1000),Z(1000),P(1000),IGRID(1000,4)
CHARACTER NAME_IN*39,NAME_OUT*39,CARD*132
WRITE(6,'('' Enter name of xxxxxxx .OUT file to be read'')')
READ(5,'(A39)')NAME_IN
OPEN(UNIT=7,
* FILE=NAME_IN,
* STATUS='OLD',
* READONLY)
MAX_GRID=0

(The file comments were edited so as to not disclose the nature of this program and replaced with xxxxx, yyyyy and zzzzz :-)


Looking through the man pages for g77, I didn't see anything obvious that would jump out at me as missing with regards to using this compiler (but I'd welcome feedback if someone else has experience in this!). Efforts to search the web for some clue to this have given me nothing more than a spectator's headache over the religious wars of the merits and speed of g77 vs. f77.

So I'd like to get an idea from someone else who has made a similar transition, as well as get an expert's (HPUX based anyway) take on the merits of g77 vs. f77, and whether I should make my upcoming job any easier in taking one route or another. (Admittedly, one other option would be to use linux, of which we have a number of machines! If that's a better alternative, then I can explore that as well.)

I'd sure appreciate some expert knowledge and experience in figuring out how to wrap my hands around this.

Thanks!

Justin
1 REPLY 1
Gregory Fruth
Esteemed Contributor

Re: g77 or f77 for HPUX as part of a migration effort from another platform?

g77 isn't recognizing the READONLY modifier.
READONLY appears to be one of the many
common-but-not-quite-everywhere extensions
to FORTRAN77 which makes it difficult to
write portable FORTRAN. I dunno how to get
g77 to recognize READONLY. In FORTRAN90 I
believe you can count on
"OPEN(...,ACTION='READ',...)" to work.
HP F77 seems to recognize READONLY.

(Note: the gcc/g77 man pages are usually not
complete; the complete documentation is in
the GNU "texinfo" system. Type "info g77".)

(Note2: HP no longer supports their F77
product. If you want to use HP FORTRAN
you should probably upgrade to their F90
product.)

As for f77 vs. g77, if you write to g77
then your code will be pretty portable,
at least to systems where you use g77 to
compile your code :-) f77 will probably
generate faster code. It's not clear
what your criteria are, so it hard to be
more specific as to the benefits of each.