Pathway/iTS TCP and Terminal Programming Guide

Processing Unsolicited Messages
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide426751-001
7-8
Using ESCAPE ON UNSOLICITED MESSAGE
Clauses
Using ESCAPE ON UNSOLICITED MESSAGE Clauses
One of the most common methods of detecting and reacting to unsolicited messages is
the interrupt technique, whereby you include ESCAPE ON UNSOLICITED MESSAGE
clauses in ACCEPT or SEND MESSAGE statements.
Example 7-1
illustrates the use of such clauses with an ACCEPT statement;
Example 7-2 does the same with a SEND MESSAGE statement.
Example 7-1. UMP and the ACCEPT Statement
GET-OPERATOR-INPUT.
ACCEPT my-screen
UNTIL f1-key
sf16-key
ESCAPE ON
TIMEOUT one-hour
UNSOLICITED MESSAGE.
PERFORM ONE OF f1-key-action
sf16-key-action
timed-out
unsolicited-message-arrival
DEPENDING ON TERMINATION-STATUS.
GO TO get-operator-input.
F1-KEY-ACTION.
* TERMINATION-STATUS = 1; respond to function-key 1 condition.
SF16-KEY-ACTION.
* TERMINATION-STATUS = 2; respond to shifted function-key 16
* condition.
TIMED-OUT.
* TERMINATION-STATUS = 3; respond to time-out condition.
UNSOLICITED-MESSAGE-ARRIVAL.
* TERMINATION-STATUS = 4; receive, process, and reply to the
* unsolicited message.
IF PW-UNSOLICITED-MESSAGE-QUEUED IS EQUAL TO "YES"
PERFORM process-unsolicited-message
UNTIL PW-UNSOLICITED-MESSAGE-QUEUED IS EQUAL TO "NO".
PROCESS-UNSOLICITED-MESSAGE.
RECEIVE UNSOLICITED MESSAGE
YIELDS unsolicited-latest-prices
ON ERROR GO TO analyze-error.
* Do something with unsolicited-latest-prices and format a
* reply message.
REPLY TO UNSOLICITED MESSAGE reply-message.
MOVE "NO" TO PW-USE-NEW-CURSOR.
* Preserves the old cursor position.