I have been trying to read and write some files in Fortran, but my knwoledge on IO is pretty limited. I have been opening the file with
OPEN(NEWUNIT=file_unit, FILE=filename, STATUS='replace', IOSTAT=file_status, &
ACTION='write', ACCESS='sequential', FORM="unformatted")
and writes are in a loop with
WRITE(file_unit, IOSTAT=file_status) var1,var2,var3...
That's all fine for writing and I get no errors. The problem is that I don't know the size of the records; the type of the variables var1 var2 and var3 MAY change between writes. When trying to read, I open the file in exactly the same way, but when I try to read
CHARACTER(LEN=1024) :: longbuf
(...)
READ(file_unit, IOSTAT=file_status) longbuf
I get IOSTAT=67 although it does read the file properly: It reads only "one record" and stores it in the longbuf variable. After going through all the records in the file it gives me the proper EOF IOSTAT which is -1.
My question is, am I doing this in the best way? What does the IOSTAT 67 stand for? I've seen that there is a IS_IOSTAT_EOF function in F2003, are there other similar intrinsic?
Thanks in advance!