Problem reading unformated file and using ERR=
Tobias Burnus
burnus@net-b.de
Wed Nov 29 17:41:00 GMT 2006
Hi,
Tobias Burnus wrote:
> Chris Talley wrote:
>
>> READ(1,ERR=10,END=100) I,J,K
>>
>> The original intent of the ERR specifier was to jump to label 10 if an
>> end-of-record occurred before all the requested data was read.
[...]
> The problem is that gfortran tries to read three numbers of the first
> record which contains only one integer; the other compilers
> automatically advance to the next record and read the first value of the
> first record and the first and second value of the second record.
>
As Thomas König correctly pointed out (in the bug report): My statement
above is nonsense.
Reading more file storage units than present in the record should indeed
trigger ERR=.
But this is not called "end-of-record" in the sense of the Fortran 2003
standard.
Thus the error in gfortran is that EOF instead of ERR is triggered in
such a case.
F 2003, 9.5.3.4.1 (Unformatted data transfer):
# On input from a file connected for sequential or direct access,
# the number of file storage units required by the input list shall
# be less than or equal to the number of file storage units in the record.
Tobias
More information about the Fortran
mailing list