# readtx statement

The readtx statement reads a tape record, converts the tape record to
 hexadecimal, and assigns the resulting hexadecimal value to a specified variable.

## Syntax

```
 readtx var[then|else|onerr statement.block]
```

## Description

The length of the tape record
is specified by the most recently executed TCL 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 clause can be
used to check for end-of-tape (eot), tape unit not ready, parity error,
or block transfer error.

Note: If a readtx is attempted without a device attached, BASIC takes the
 else clause with system(0) = 1, but FlashBASIC
 attempts the read.

## See also

- [onerr clause](https://d3codex.com/pickbasic-flashbasic/onerr-clause/)
- [readt statement](https://d3codex.com/pickbasic-flashbasic/readt-statement/)
- [rewind statement](https://d3codex.com/pickbasic-flashbasic/rewind-statement/)
- [set-device command](https://d3codex.com/tcl/set-device-command/)
- [statement blocks](https://d3codex.com/pickbasic-flashbasic/statement-blocks/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)
- [system() function](https://d3codex.com/pickbasic-flashbasic/system-function/)
- [t-att command](https://d3codex.com/tcl/t-att-command/)
- [then/else statement blocks](https://d3codex.com/pickbasic-flashbasic/then-else-statement-blocks/)

---
Source: https://d3codex.com/pickbasic-flashbasic/readtx-statement/ - part of the D3Codex reference.
