|Command||basic.weof Statement/BASIC Program
Applicable release versions: AP, R83
|Category||BASIC Program (486)|
|Description||writes an "end of file" mark to the currently attached magnetic media.
The "then" clause is executed if the operation was successful. If the operation was unsuccessful, the "else" or "onerr" clause is executed.
The "onerr" clause may be used to check for tape error conditions by interrogating the "system(0)" function. Either "else" or "onerr" may be specified, but not both.
See the "then/else construct" for an explanation on the use of "then" and "else" clauses in statements that allow or require them.
|Syntax||weof variable [then | else | onerr statement.block]|
In this "subroutine", a series of tapes files are written using items in a previously formatted disk file. The items represent tape blocks and the ids are numbered 1 though M, where M is the block count. When a null item is encountered, the logic assumes that an "eof" is to be written to tape. Two "eof"s indicate an end-of-data condition. subroutine outtape execute 't-att ':blocksize if system(0) = "1" then ; * tape not attached err=system(0) return end ctr=1; eot=0 ; err=0 loop read block from tape.hold.file,ctr then if block='' then ;* a null block in the file ;* write an eof. weof else err=system(0) end else writet block else err=system(0) end end else eot=1 until eot or err do ctr=ctr+1 repeat if eot then ;* at end-of-tape weof then ; * write 2 eof's weof else err=system(0) end else err=system(0) end return