basic.writet

Statement/BASIC Program, Releases: AP and R83

Writes a string to magnetic media.

Syntax

writet expression [then | else | onerr statement.block]

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.

Example

record = name 'l#20' : address 'l#15'
writet record else stop

See Also

Command Name Type Description
basic.statements Definition Definition of statements and functions.
basic.readt Statement Reads one tape record.
tcl.set-device Verb: Access Attaches device (sct/floppy/half) on AIX.
tcl.set-floppy Verb: Access Attaches floppy diskette drive to current process.
tcl.set-sct Verb: Access Attaches streaming cartridge tape to current process.
tcl.set-half Verb: Access Attaches half-inch tape drive to current process.
tcl.t-select Verb: Access Attaches a 'tape' device.
tcl.t-att Verb: Access Attaches magnetic media unit to current process.
basic.if Statement Initiates logical expression.
basic.then/else.construct Definition provide program flow change based upon a boolean condition.
basic.then Statement In-line initiator.
basic.else Statement In-line initiator.
basic.onerr Definition Takes 'error' path when media error encountered.
statement.block Definition one or more statements that follow a Pick/BASIC decision-path related token such as, but not limited to, 'then', 'else', 'locked' and 'onerr'.
tcl.t-stat Verb: Access reports the current attachment status of all tape devices.
basic.weof Statement Writes an end-of-file mark to tape.
basic.system Function Displays status of system-controlled variables.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.