fortranfortran90

Syntax error at buffered='yes' in an open statement


I am writing a Fortran program in which one line is written like this

open(unit=un1,file=filenm,form='unformatted',buffered='yes',status='replace',buffercount=127)

I have defined

character*256 filenm.
un1=11

but still I am getting error

"Syntax error at or near =" in that line..

Solution

  • The problem lies in the buffered='yes', which is not standard Fortran, but some vendor extension and your compiler does not recognize it. I would just delete it and also delete the buffercount=127 (mentioned in the comment).

    Modern compilers and operating systems allow control of these things (external I/O buffering) by other means. For example, using environment variables in gfortran https://gcc.gnu.org/onlinedocs/gfortran/Runtime.html#Runtime