basic.send Statement/BASIC Program

basic.send

Command basic.send Statement/BASIC Program
Applicable release versions: AP
Category BASIC Program (486)
Description sends output to a specified port.

The port to which the output is being sent must be attached with the "dev-att" command.

In the "send" statement, the first expression is evaluated as a string. This string may contain any data formatting expressions which work in the "print" or "crt" statements including cursor positioning, "@(column,row)", and special functions, "@(-n)". The actual codes that are generated is determined by the terminal characteristics of the process executing the "send", NOT the port to which the characters are being passed. The correct terminal type must be established with the "term" command.

The optional ":" (colon) supresses a terminating carriage return, line feed.

The "port.number" expression must evaluate to a valid port number. If the port number is invalid, and there is no "else" clause, the program aborts into the Pick/BASIC debugger. If there is an "else" clause, it is executed when the port.number is invalid.

The "send" statement is typically used after a port has been attached by the sending process. Attachment ensures that the process has exclusive use of the port. Data may be sent to any port that is linked (but not attached) to another process. If the port is attached to another process, the "else" clause is executed.

Both the "then" and "else" clauses are optional, but, at least one must be specified.

The "sendx" statement converts the exploded ASCII hexadecimal string results of "string.expression" to its binary equivalent and then transmits it to the specified port. The conversion process terminates when the first non-hexadecimal character is encountered. "sendx" supresses the output of a carriage return, line feed pair. "sendx" does not allow the ":" (colon) to exist as part of the statement.

See the "then/else construct" for an explanation on the use of "then" and "else" clauses in statements that allow or require them.
Syntax send{x } string.expression{:} to port.number {then | else statement.block}
Options
Example
execute "dev-att 10"
send 'begin transmission' to 10 else print 'port in use'
execute "dev-det 10"

This sends the string, 'begin transmission', to port 10. If port 10 
is already attached by another process, the "else" clause is executed.

send msg: to device1 then print 'message sent'

The string in "msg" is sent without a carriage return and line feed 
to the device addressed by "device1". If successful, the 
"then" clause is executed.

sendx msg to device1 then print 'hex message converted to binary and 
sent'

The binary equivalent of the ASCII hexadecimal string in "msg" is 
sent to the port addressed by "device1" and if successful, prints a 
message.

execute "dev-att 10"
string = "hello there"
send @(10,9) : string : to 10 then crt "string sent" else crt 
"string not sent"

This sends the string, "hello there", to port 10 at position column 
position 10 on row 9. The term type of the SENDER must match with the terminal 
of the RECEIVER for this to work correctly.
Purpose
Related statement.block
basic.then/else.construct
ue.e0ba
tcl.dev-att
basic.get
tcl.dev-det
basic.in