WRITET Statement
Writes a record to tape.
Syntax
WRITET char-string [THEN statement(s) | ELSE statement(s)]
Syntax Elements
char-string is a DataBasic expression that evaluates to a string. This will be written as the next record on the tape.
statement(s) is either a
THEN or an ELSE clause (or both). A statement must be included. The THEN
clause is executed if the write is successful. The ELSE clause is executed if
the tape unit has not been attached, or if the string value of
Comments
The maximum record size that can be written to tape is
controlled by the
ASSIGN or
T-ATT command.
For example, T-ATT 1 SIZE=2048
sets the maximum record size written to 2048. When writing,
if necessary, records are padded to 20 bytes with segment
marks; these are deleted when read.
DataBasic writes a label when the first WRITET statement is
executed or when a WRITET is executed after a rewind or after an EOF has been
written. If you want to write to an unlabelled tape you must either first
assign/attach the tape using LABEL=0 in the
ASSIGN or
If you have not attached the tape, the software displays the error message:
[1129] No such tape assignment exists
and your program is terminated.
For more information on tape handling, see Overview of Tape Operations.
Examples
WRITET A+5 THEN PRINT "WRITTEN TO TAPE" ELSE STOP
Writes the value of A+5 as the next record on tape and prints WRITTEN TO TAPE on the terminal. If the tape unit is not attached or if A+5 is a null value, the program terminates.
FOR I=1 TO 5
WRITET A(I) ELSE STOP
NEXT I
Writes the values of array elements A(1) through A(5) onto 5 tape records. If one of the array elements has a value of '' (null) or if the tape unit is not attached, the program terminates.