reading back a partially-written record on direct access



Is the following program standard-conforming?

PROGRAM test
IMPLICIT NONE
CHARACTER*8 as_written, as_read
INTEGER irec
INTEGER i
as_written = "12345678"
inquire (iolength=irec) as_written, i
OPEN (76, FILE="test.txt", ACCESS="DIRECT", STATUS="NEW",
& RECL=irec)
WRITE(76, REC=1) as_written
READ(76, REC=1) as_read, i
PRINT *, "as_written = ", as_written, " as_read = ", as_read
CLOSE(76)
END PROGRAM test

I don't think it is, because it reads something that wasn't written
(the variable i). On the other hand, i isn't used, so it may be OK.

.



Relevant Pages