Using Plato & F90 with the program on a memory stick, I want to write a file, remove and then re-connect the stick and then read the file. The following program fails at line 26 with the message 'A device which does not exist ...'. What's wrong?
PROGRAM SSFM5 ! stored on memory stick
IMPLICIT NONE
CHARACTER*8 MESSAGE
LOGICAL EX
INTEGER ISCR
ISCR=6
OPEN (7,FILE='Xtime.txt',STATUS='new') ! write to stick
WRITE (7,*)'ABC'
CLOSE(7)
CALL SLEEP@(5)
WRITE(ISCR,*)' DISCONNECT NOW'
1 INQUIRE(FILE='Xtime.txt',EXIST=EX) ! test for disconnect
IF (EX) GOTO 1
WRITE(ISCR,*)
WRITE(ISCR,*)' OK'
WRITE(ISCR,*)' WAIT FOR A FEW SECONDS THEN RECONNECT'
2 INQUIRE(FILE='Xtime.txt',EXIST=EX) ! test for connect
IF (.NOT. EX) GOTO 2
OPEN (7,FILE='Xtime.txt') ! read from stick
READ(7,'(A)')MESSAGE
CLOSE(7)
WRITE(ISCR,*)MESSAGE
3 GOTO 3
END
PROGRAM SSFM5 ! stored on memory stick
IMPLICIT NONE
CHARACTER*8 MESSAGE
LOGICAL EX
INTEGER ISCR
ISCR=6
OPEN (7,FILE='Xtime.txt',STATUS='new') ! write to stick
WRITE (7,*)'ABC'
CLOSE(7)
CALL SLEEP@(5)
WRITE(ISCR,*)' DISCONNECT NOW'
1 INQUIRE(FILE='Xtime.txt',EXIST=EX) ! test for disconnect
IF (EX) GOTO 1
WRITE(ISCR,*)
WRITE(ISCR,*)' OK'
WRITE(ISCR,*)' WAIT FOR A FEW SECONDS THEN RECONNECT'
2 INQUIRE(FILE='Xtime.txt',EXIST=EX) ! test for connect
IF (.NOT. EX) GOTO 2
OPEN (7,FILE='Xtime.txt') ! read from stick
READ(7,'(A)')MESSAGE
CLOSE(7)
WRITE(ISCR,*)MESSAGE
3 GOTO 3
END