Fortran runtime error: Cannot read from file opened for WRITE
Hi Friends,
What is the problem in my statements? !6. Model I/O file properties !---------------------------- ! !6.1 Input !---open boundary conditions (2-D) modfiles(io_2uvobc,1:2,1)%status = 'N' modfiles(io_2uvobc,2,1)%form = 'A' modfiles(io_2uvobc,2,1)%filename = 'DATA/discharge.csv' modfiles(io_2uvobc,2,1)%tlims = (/0,int_undef,1440/) !6.2 output ! ---open boundary conditions (2-D) modfiles(io_2uvobc,1:2,2)%status = 'W' modfiles(io_2uvobc,1:2,2)%form = 'U' ! !1. Open file !------------ ! IF (modfiles(io_2uvobc,ifil,1)%iostat.EQ.0) THEN CALL open_filepars(modfiles(io_2uvobc,ifil,1)) iunit = modfiles(io_2uvobc,ifil,1)%iunit modfiles(io_2uvobc,ifil,1)%iostat = 1 READ (iunit,*) GOTO 1000 ENDIF ciodatetime = CStartDateTime !2. Read data !------------ ! READ(iunit,*) qdis1,qdis2 !---close file CALL close_filepars(modfiles(io_2uvobc,ifil,1)) I try to add a river discharge file to my program but when I run it, this error comes up: Fortran runtime error: Cannot read from file opened for WRITE Thank you, Sara |
It is a long time since I looked at Fortran and you don't specify the compiler. Do you need to open READWRITE?
|
seeing as code tags were not used
my first guess is the formatting and tabs |
this is the rest of the code that I didn't put in my first post:
1000 CALL log_timer_out() RETURN END SUBROUTINE my compiler is gfortran and the compiling is fine apparently. John, could you please explain more? Thanks from both of you, Sara |
All times are GMT -5. The time now is 07:13 PM. |