Envoy Application Programming Manual

Table Of Contents
ADM-2 Multipoint Supervisor Protocol
Envoy Application Programming Manual427159-001
7-46
WRITEREAD (Send Function and Read Message)
Example 7-24 shows the program coding for the fast-select operation sequences shown
in Example 7-23.
WRITEREAD (Send Function and Read Message)
The WRITEREAD procedure is used to transmit a send function to a terminal and
receive the data sent from the terminal. In the following example (Example 7-25), it is
assumed that the terminal operator pressed a function key (F1:F16) to signal the
application process to read the data from the terminal’s screen. The pressing of a
function key causes a specially formatted message to be sent by the terminal when the
terminal is polled.
Example 7-24. Program Code for a Fast-Select Message
PROC fast^select (message, length, terminal);
STRING .message; ! message to be sent.
INT length, ! message length.
terminal; ! terminal address in ASCII.
BEGIN
STRING .s;
! clear message control word.
mcw := 0;
! set message type = special.
mcw.<6> := 1;
! set message formatter = application process.
mcw.<5> := 1;
! format message.
@s := @slinebuf;
s := [ EOT ];
s[1] := terminal; ! terminal address twice.
s[2] := terminal; !
s[3] := "s"; ! fast-select function code.
@s := @s[4];
s ’:=’ [ STX ] & message FOR length & [ ETX ] - @s;
! compute length of message.
line^write^count := @s ’-’ @sline^buf[-2];
! send the message.
CALL WRITE (linefnum, linebuf[-1], line^write^count);
IF THEN ... ! bad news.
END; ! fast^select.
Note. This WRITEREAD procedure can be used to minimize the system buffer space (that is,
SHORTPOLL and IOPOOL) in use while the terminal operator fills the terminal’s screen. If a
function key is used to signal that the screen entry is completed, the READ that polls the net-
work has to contain only five characters. The WRITEREAD that reads the screen, however,
must specify a read count of sufficient length to read the expected data.