Using $RECEIVE
Initiating and Communicating With Processes
5–24
107365 Tandem Computers Incorporated
Figure 5-10. Sending Messages to a Terminal (Page 3 of 3)
|OTHERWISE|
== The user did not supply a device name. Display help
== text.
output_help_text
#UNFRAME
#RETURN
] == end of outer #CASE
== Obtain the current time
== Note: the underscores act as placeholders for unwanted
== text.
#SETMANY _ _ _ origin_time_hh origin_time_mm, &
[#CONTIME [#TIMESTAMP]]
[#IF (origin_time_mm < 10) |THEN|
== If the minute value in the timestamp is less than 10,
== add a zero to the front of the number to keep it at
== two digits.
#SET origin_time_mm 0[origin_time_mm]
]
#SET origin_time [origin_time_hh]:[origin_time_mm]
== Build the message
#SET message [L25:char(0:1)][origin_time] == Line 25
#SET message [message] [#USERNAME
[#PROCESSINFO/PAID/[#MYPID]]] == Orig userID
#SET message [message] [temp_message] == The message text
== Open the destination device
#SET req_status [#REQUESTER WRITE [destination_name] &
error send_message]
[#IF ( req_status <> 0 ) |THEN|
== The open failed. Report the error and exit.
#OUTPUT The open of the terminal failed with Guardian &
Error [req_status].
#UNFRAME
#RETURN
]
#APPENDV send_message message == Send the message
[#IF [#MATCH [#VARIABLEINFO/VARIABLE/ &
[#WAIT send_message error]] error] |THEN|
#OUTPUT Write to the terminal failed: Guardian Error [error]
]
#SET req_status [#REQUESTER CLOSE error]
[#IF ( req_status <> 0 )
|THEN| == Close failed
#OUTPUT Close of the terminal failed: Guardian Error &
[req_status]
]
#OUTPUT Message to [destination_name] Transmitted
#UNFRAME