1

I'm trying to compile a very old code but I get this error while compiling the code

   Error: Syntax error in OPEN statement at (1)

The code:

      WRITE(LUTTO,'('' TYPE NAME OF FILE CONTAINING INPUT   : '',$)')
C      READ (LUTTI,'(Q,A)') NCHAR,FILNAM
      READ (LUTTI,'(A)') FILNAM
      NCHAR = len_trim(FILNAM)
C                                             ----- OPEN DATA FILE -----
      print *, "NCHAR"
      OPEN( UNIT           = LUINP, NAME  = FILNAM(1:NCHAR),
     $      STATUS         = 'OLD', RECL  =             80 ,
     $      CARRIAGECONTROL= 'LIST', ERR   =           9900 )
3
  • We can't help you unless one has a minimal working example. Commented Oct 1, 2016 at 19:44
  • from gfortran docs "Some Fortran compilers, including g77, let the user declare OPEN( ... NAME=). This is invalid standard Fortran syntax and is not supported by gfortran. OPEN( ... NAME=) should be replaced with OPEN( ... FILE=). " Commented Oct 2, 2016 at 14:59
  • CARRIAGECONTROL is also not standard. I believe "LIST" requests no carriage control, which is what modern compilers do by default so just get rid of it. Kind of sad your compiler doesn't give a more informative error message. FWIW carrige control would put an extra blank space at the start of every line, which you may or may not even notice. Commented Oct 2, 2016 at 15:08

1 Answer 1

2

name=... in the open statement is invalid

try file=... instead

Sign up to request clarification or add additional context in comments.

2 Comments

I just saw that in the GNU documentation. I think it now has something to do with the carriagecontrol or the err
you should delete "carriagecontrol=list" as well as "recl=80" which are not necessary. About err=9900, you just have to check the existence of the label 9900 somewhere in your procedure...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.