I'm trying to read .csv files with Fortran 90, but I've gotten back this error message.
forrtl: severe (59): list-directed I/O syntax error, unit 21, file /data3/khee/data/AWS/ASCII/STATION/2021/csvfile/test.csv
Image PC Routine Line Source
a.out 000000000043B9EE Unknown Unknown Unknown
a.out 0000000000412AB0 Unknown Unknown Unknown
a.out 00000000004036D3 Unknown Unknown Unknown
a.out 00000000004034DE Unknown Unknown Unknown
libc-2.17.so 000000333901F84D __libc_start_main Unknown Unknown
a.out 00000000004033E9 Unknown Unknown Unknown
And I soon realized that "the colon" (:) of the input file causes this problem. The problem is my Fortran code can't read "the colon" as a character. But I can't edit the input files.
How can I fix it?
here's my Fortran code, and sample phrase of the input file.
program read_data
implicit none
integer :: HSID, DSID
real :: HLAT, HLON, HALT, DTEMP, DWDEG, DWSPD, DPRCP, DSPRS, DMSLP, DHMD, DSR, DSRH
character(len=16) :: DATE
open(21,file='/data3/khee/data/AWS/ASCII/STATION/2021/csvfile/test.csv',form='formatted',access='sequential',status='old')
10 read(21,*,end=90) DSID, DATE, DTEMP, DWDEG, DWSPD, DPRCP, DSPRS, DMSLP, DHMD, DSR, DSRH
write(*,*) DSID, DATE, DTEMP, DWDEG, DWSPD, DPRCP, DSPRS, DMSLP, DHMD, DSR, DSRH
go to 10
90 continue
write(*,*) "EOF"
stop
end program read_data
848,2021-01-01 00:00,-4.1,9.1,2,0,,,,0,0
thank you!