writet Statement

The writet statement writes a tape record to the attached magnetic media from the specified variable.

Syntax

writet exp [then statement.block {[else|onerr.clause] statement.block}]

Parameter(s)

exp

If the size of the expression is less than the attached tape block size, it is padded to fill the block size. If it is greater than the block size, it is truncated.

onerr.clause

An optional onerr.clause can be specified, which consists of the clause onerr followed by a statement block. The else or onerr clause is executed if the tape unit is not attached or the string value of expression is an empty string ('').

Description

The then clause is executed if the writet is successful. Either else or onerr can be specified, but not both. In addition, the onerr clause can be used to check for tape error conditions by interrogating the system(0) function.

NOTE

To ensure the block is written, write a file mark. weof flushes the buffer to tape and writes an end-of-file mark (eof) on the tape.

Example(s)

record = name ’l#20’ : address ’l#15’

writet record else stop

See Also

else Clause, if Statement, onerr Clause, readt Statement, set-device Command, set-floppy Command, set-half Command, set-sct Command, Statement Blocks, Statements and Functions, system() Function, t-att Command, t-select Command, t-stat Command, then Clause, then/else Statement Blocks, weof Statement