| WRITE | Index Level | WRITEU |
| Syntax | WRITET expression [THEN statement.block {[ELSE | ONERR] statement.block}] |
| Category | BASIC |
| Type | Statement |
| Description |
writes a tape record to the attached magnetic media from the specified variable.
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. The "then" clause is executed if the "writet" is successful. The "else" or "onerr" clause is executed if the tape unit is not attached or the string value of expression is an empty string (''). Either "else" or "onerr" may be specified, but not both. In addition, the "onerr" clause may be used to check for tape error conditions by interrogating the "system(0)" function. See the "then/else construct" for an explanation on the use of "then" and "else" clauses in statements that allow or require them. Note: To ensure the block is written write a file mark. See "weof" statement. The "weof" will flush the buffer to tape and write an end-of-file mark on the tape. |
| Options | |
| See Also | statements & functions READT set-device set-floppy set-sct set-half t-select t-att IF THEN | ELSE statement.block THEN ELSE ONERR statement.block t-stat WEOF SYSTEM |
| Example |
record = name 'l#20' : address 'l#15'
writet record else stop |
| Warnings | onerr works on D3 only. |
| Compatibility | D3 7.0 AP R83 |
| WRITE | Index Level | WRITEU |