The weof statement writes an eof (end of file) mark to the currently attached magnetic media.
Syntax
weof var [then statement.block {[else|onerr] statement.block}] |
Description
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 can be used to check for tape error conditions by interrogating the system(0) function. Either else or onerr can be specified, but not both.
See then/else Statement Blocks for an explanation on the use of then and else clauses in statements that allow or require them.
Example(s)
In this subroutine, a series of tape 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 marks indicate an end-of-data condition.
subroutine outtape execute ’t-att ’:blocksize * tape not attached if system(0) = "1" then err=system(0) return end ctr=1; eot=0 ; err=0 loop read block from tape.hold.file,ctr then * a null block in the file if block=’’ then * 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 * at end-of-tape if eot then * write 2 eof’s weof then weof else err=system(0) end else err=system(0) end return |
See Also