SEND Statement

The SEND statement acts as a DISPLAY or CRT to a remote line.

Format

SEND print-expr TO line-expr  [THEN

   statements

END] [ELSE

   statements

END]

Parameter(s)

print-expr

Print expression evaluating to the data string to be sent to the remote device. print-expr may follow the same format as output expressions for the PRINT, CRT, or DISPLAY statements, combined with commas for tabulation, format masks, and @-functions to format the screen. See PRINT Statement for more information on the syntax for print-expr.

line-expr

An expression evaluating to the line number to which the data should be sent. If line-expr is not a valid line number, a run-time error occurs and the user is placed in the mvBASIC Debugger.

THEN statements

If data is successfully sent, execute statements. Either the THEN or ELSE clause, or both, must be specified.

ELSE statements

If data cannot be sent, execute statements. Either the THEN or ELSE clause, or both, must be specified.

Description

The SEND statement sends data to the process linked to the specified line. It functions as a PRINT, DISPLAY, or CRT statement for a remote process, accepting all data formats supported by PRINT, DISPLAY, or CRT.

A line does not need to be attached to the sending process before a SEND statement is used, but it cannot be attached to another process. If the line is attached to another process, the ELSE clause is executed. It is recommended to attach the line before using the SEND statement, to ensure that the sending process has exclusive use of the line.

CAUTION

In using the @ function to provide terminal escape sequences, be warned that the @ function is dependent on the specifications of the operator’s terminal only. The @ function does not produce the expected results if the remote line is not linked to a terminal with the same emulation as the operator’s terminal.

Example

To send the string HI to line 7, the code would read:

SEND "HI" TO 7 ELSE

   PRINT "COULD NOT SEND"

END

In the next application, the operator is allowed to send a message in blinking mode to an attached line.

PRINT "SEND TO WHAT LINE" :  

INPUT LINE   

PRINT "WHAT MESSAGE" :    

INPUT MESSAGE    

SEND @(-5) : MESSAGE : @(-6) TO LINE THEN    

   PRINT "MESSAGE SENT IN BLINKING MODE TO LINE " :

   LINE

END ELSE

   PRINT "CANNOT SEND MESSAGE."  

END

See Also

Statement and Function Reference