Re Namelist IOSTAT behaviour
Paul THOMAS
paulthomas2@wanadoo.fr
Thu Jun 9 19:25:00 GMT 2005
IOSTAT should indeed yield a negative value because EOF has occurred with no error. This is indeed what happens in gfortran, with the small program below.
If I change the &q to &p in the string written to unit 10, I get IOSTAT=-1 twice, followed by 9.
I think that we need to see the rest of your code before agreeing that there is a bug.
Paul T
$ cat test_eof.f90
program test_eof
character*4 :: a
namelist /q/ a
open(10, status="scratch")
write(10,*) "&q a=wxyz /"
rewind(10)
do j = 1,3
a = ""
read(10,nml=q,iostat=i)
print *, a, i
end do
end program test_eof
$ ./a
wxyz 0
-1
9
More information about the Fortran
mailing list