0

I'm in trouble while reading a CSV file with about 2 Gb:

    OPEN(unit=11,status='OLD',file=fin,form='formatted')
    IEND=0
    n=0
    DO
      n=n+1
      READ(11,*,IOSTAT=iEND1) RECORD
      IF (IEND==0) THEN
         deal with RECORD 
     ELSEIF (IEND>0) THEN
       PRINT *, IEND
     ELSE
        STOP 'END OF FILE'
     ENDIF
   ENDDO
   CLOSE(UNIT=11)

...

RECORD is an own defined type.

For some reason, everything goes fine up to reading record number 24200. There are about 21 million records in the file. I'm getting an IOSTAT=5010 message and RECORD comes back empty.

I carefully looked into the formatted file with vi -b file.csv and everything seems fine.

I'm using GNU Fortran (GCC) 5.2.0.

What does this IOSTAT coded really mean?

Mario
  • 1
  • 1
  • 3
    Please see [mcve]. If your code causes an erro, we need the actual code that causes the error. You can use the `IOMSG=` specifier to get the error message. Or just delete the `IOSTAT=` and read the error message you get on the screen. Or search the manual of your compiler to found out what error has the code 5010. – Vladimir F Героям слава May 28 '22 at 14:34
  • 2
    IOSTAT=5010 is LIBERROR_READ_VALUE. That value occurs 22 times in gfortran's IO code. Try using Fortran's `iomsg` feature to more information. – steve May 28 '22 at 17:26

0 Answers0