1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
! demonstrates basic direct access using variables for REC ! pr14872 OPEN(UNIT=10,ACCESS='DIRECT',RECL=128) DO I = 1,10 WRITE(10,REC=I,ERR=10)I ENDDO CLOSE(10) OPEN(UNIT=10,ACCESS='DIRECT',RECL=128) DO I = 1,10 READ(10,REC=I,ERR=10)J IF (J.NE.I) THEN ! PRINT*,' READ ',J,' EXPECTED ',I CALL ABORT ENDIF ENDDO CLOSE(10,STATUS='DELETE') STOP 10 CONTINUE ! PRINT*,' ERR= RETURN FROM READ OR WRITE' CALL ABORT END