Using the optional RETURNING clause with magnetic tape or floppy disk I/O statements (READT, READTX, REWIND, WEOF, and WRITET) enables Basic Tape or Floppy Disk Error Handling. If a tape or floppy disk error occurs while using the RETURNING clause, the tape or floppy disk error is assigned to the returning variable, and program control continues through the ELSE clause. See READT Statement, READTX Statement, REWIND Statement, WEOF Statement and WRITET Statement for format:.
This table describes the supported errors and suggested actions that may be taken:
Returned Error |
Error Description |
Action(s) |
1 |
Tape or floppy disk not attached |
Attach tape unit or floppy disk unit. |
2 |
Short block error |
Incorrect block size. Adjust block size. |
3 |
Command reject |
Retry last tape or floppy disk command. |
4 |
Parity error |
If error occurs during write operations, remove bad tape or floppy disk. If error occurs during read operations, attempt to recover. Service the tape drive or floppy disk drive. |
5 |
End of file |
User defined. |
6 |
End of data |
User defined. |
7 |
End of tape of floppy disk |
Write a file mark, mount next tape or floppy disk, and continue operations. |
8 |
Tape or floppy disk write protected |
Write enable tape or floppy disk. |
9 |
Tape drive or floppy disk drive not ready |
Turn tape drive or floppy disk drive on line. |
10 |
Incorrect tape or floppy disk label format |
Change label format. |
If multiple tape or floppy disk errors occur, several error values separated by attribute marks (character x'FE') are returned. The error string may be processed as a dynamic array to handle each error condition.
NOTE |
Error value 1 indicates a "Tape or floppy disk not attached" error. The same error would be returned if the SYSTEM(0) function were used. |
If the ELSE clause was not executed (signifying that no error occurred) and the variable used in the RETURNING clause is referenced, the value of the variable will be null. If the ELSE clause is executed and the variable is null, the SYSTEM(0) function should be used to obtain the error.
End of Data (EOD) is handled differently on various tape drives. Listed below are the errors returned from these tape drives for EOD:
60MB Tape Drive returns errors 4,6
150MB Tape Drive returns error 6
Basic Tape and Floppy Disk Error Handling does not support O/S controlled tape or floppy disk chaining via the T-SELECT command from TCL since all tape or floppy disk errors, including "End of Tape or Floppy Disk," are passed back to the application program. Passing control to the next tape or floppy disk must be done in the application program.
See Also