Fortran compile problem

Hello everyone,

I am trying to compile a code under fedora14.Kernel Linux 2.6.35.6-45fc14.i686-GNOME 2.32.0. I use f77,g77 and gfortran to compile but I get the same error all ways.

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
simulps14.for:700: 
         open(unit=02,status='old',form='formatted',file='STNS',read only)        ^

and open statements are like this:

      open(unit=02,status='old',form='formatted',file='STNS',read only)
      rewind (02)
      call input2
      close(02)

What could be the reason of this problem? I have checked and some pages say that the problem could be solved by changing the code. In my case, since the code is nearly 10000 lines long, it is impossible for me to change it and I have a little knowledge about Fortran.

What should I do to compile the code? Should I try unix or sun??? Is that be the reason?

Thank you everyone!!

Hi.

The "read only" part of the open will not compile on any Fortran that I know of.

The error message that I get is:

open(unit=02,status='old',form='formatted',file='STNS',read only)
                                                      1
Error: Syntax error in OPEN statement at (1)

Here's a script that lists, compiles, and executes an alternative that will compile, assuming that what the code really wanted was to not write on the file:

#!/usr/bin/env bash

# @(#) s1	Demonstrate open statement Fortran-90.

# Utility functions: print-as-echo, print-line-with-visual-space, debug.
# export PATH="/usr/local/bin:/usr/bin:/bin"
pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
db() { ( printf " db, ";for _i;do printf "%s" "$_i";done;printf "\n" ) >&2 ; }
db() { : ; }
C=$HOME/bin/context && [ -f $C ] && $C gfortran

# Create dummy data file.

echo "Hi" > STNS

FILE=${1-one.f90}

pl " Input data file $FILE:"
cat $FILE

pl " Results:"
gfortran $FILE
./a.out

exit 0

producing:

% ./s1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution        : Debian GNU/Linux 5.0.8 (lenny) 
bash GNU bash 3.2.39
gfortran GNU Fortran (Debian 4.3.2-1.1) 4.3.2

-----
 Input data file one.f90:
program f1

! @(#) f1	Demonstrate Fortran-90.

! open(unit=02,status='old',form='formatted',file='STNS',read only)
open(unit=02,status='old',form='formatted',file='STNS',action='read')
rewind (02)
! call input2
close(02)

write(*,*) ' Hello, world from one, gfortran.'

end

-----
 Results:
  Hello, world from one, gfortran.

If you are going to be using Fortran, I suggest you pick up a book on current Fortran. One that I have been using lately is: Amazon.com: Modern Fortran Explained (Numerical Mathematics and Scientific Computation) (9780199601424): Michael Metcalf, John Reid, Malcolm Cohen: Books -- not cheap, but one of the best-reviewed lately.

See also usenet group comp.lang.fortran (but probably not through Google, they seem to let all the spam come through).

Best wishes ... cheers, drl