SEND statement
Syntax
SEND output [:] TO device
{ THEN statements [ ELSE statements ] | ELSE statements }
Description
Use the SEND statement to write a block of data to a device. The SEND statement can be used to write data to a device that has been opened for I/O using the OPENDEV statement or OPENSEQ statement.
output is an expression evaluating to a data string that will be written to device. If the optional colon is used after output, the terminating newline is not generated.
device is a valid file variable resulting from a successful OPENDEV or OPENSEQ statement. This is the handle to the I/O device that supplies the data stream for the operation of the SEND statement.
The SEND syntax requires that either a THEN or an ELSE clause, or both, be specified. If data is successfully sent, the SEND statement executes the THEN clause. If data cannot be sent, it executes the ELSE clause.
The data block specified by output is written to the device followed by a newline. Upon successful completion of the SEND operation, program control is passed to the THEN clause if specified. If an error occurs during the SEND operation, program control is passed to the ELSE clause if specified.
Example
The following code fragment shows how the SEND statement is used to write a series of messages on a connected device:
OPENDEV "TTY10" TO TTYLINE ELSE STOP "CANNOT OPEN
TTY10"
LOOP
INPUT MESSAGE
WHILE MESSAGE # "QUIT" DO
SEND MESSAGE TO TTYLINE
ELSE
STOP "ERROR WRITING DATA TO TTY10"
END
REPEAT