basic.readt

Statement/BASIC Program, Releases: AP and R83

Reads one tape record.

Syntax

readt variable [then | else | onerr statement.block]

Description

reads a tape record and assigns the value returned to a specified variable.

The length of the tape record is specified by the most recently executed 't-att' command.

The 'then' clause is taken if the operation is successful.

Either 'else' or 'onerr' can be specified, but not both. If the tape unit has not been attached or if an end-of-file (EOF) mark is read, the 'else' or 'onerr' clause, if present, is executed. In addition, the 'onerr' statement can be used to check for end-of-tape (EOT), tape unit not ready, parity error, or block transfer error. See 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.

Example

execute 't-att'
rewind else stop
eot=0
loop
readt rec else eot=1
until eot do
print trim(rec[1,25])
repeat
Reads a series of tape records and displays the first 25 bytes of each record.
The 'readt' else clause is usually taken when an end-of-tape or
end-of-data condition is reached. The 'system(0)' function indicates
whether there are any other unexpected problems.

See Also

Command Name Type Description
basic.rewind Statement Rewinds magnetic media.
basic.then/else.construct Definition provide program flow change based upon a boolean condition.
basic.then Statement In-line initiator.
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-att Verb: Access Attaches magnetic media unit to current process.
basic.weof Statement Writes an end-of-file mark to tape.
basic.writet Statement Writes a string to magnetic media.
basic.onerr Definition Takes 'error' path when media error encountered.
basic.statements Definition Definition of statements and functions.
basic.readtl Statement Reads label from magnetic media.
basic.readtx Statement Reads one tape record and displays in hexadecimal.
tcl.t-select Verb: Access Attaches a 'tape' device.
tcl.t-stat Verb: Access reports the current attachment status of all tape devices.
basic.system Function Displays status of system-controlled variables.
tcl.set-sct Verb: Access Attaches streaming cartridge tape to current process.

User Comments

What do you think?

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

Login to leave your comments.