next up previous contents
Next: UNFORMATTED or BINARY I/O Up: READ and WRITE statements Previous: The I/O list

   
END= and ERR=

In a READ statement the user can code, after the format reference:-
END= statement label
For example:-
READ(LUNTTL,90007,END=1000) (IQ(I),=1,10)
If the I/O is successful, execution proceeds normally but if it fails because the end of file has been reached then control is transferred to the statement 1000. The END= is very useful. The user will often encounter situations in which all the records from a file must be read but the number of records to be read is unknown. If the end of the file is reached and the user has not supplied an END= the program terminates with an error message. In both READ and WRITE statements the user can add, again after the format reference :-
ERR= statement label
For example:-
WRITE(25,90002,ERR=500) ARRAY
If the I/O falls due to any sort of error (end of file on input is not considered as an error) then control is transferred to statement 500. Like END= if a I/O fails with an error and the user has not given an ERR= the program terminates. A READ can have both END= and ERR= and either may appear first e.g.
READ(INPUT,1000,END=200,ERR=250) ZZZ

next up previous contents
Next: UNFORMATTED or BINARY I/O Up: READ and WRITE statements Previous: The I/O list
n west (APC)
2000-03-08