Envoy Application Programming Manual

Table Of Contents
BISYNC Centralized Multipoint Supervisor Protocol
Envoy Application Programming Manual427159-001
4-52
Programming Examples
Example 4-20. Program Code for Poll and Select Procedures (Page 4 of 7)
sbuf ':=' "FROM " -> @s;
s := IF $ALPHA (source.<8:15>) THEN source.<8:15>
ELSE source.<8:15> LOR %60; ! convert binary to
s[1] := ":"; ! numeric.
s[2] ':=' [" "] & array FOR length -> @s;
! display the message.
done := 0;
WHILE NOT done DO
BEGIN
CALL WRITE (termfnum, buf, @s '-' @sbuf);
CALL AWAITIO (termfnum);
IF = THEN done := 1
ELSE
IF NOT FILEERROR (termfnum)
THEN CALL ABEND; ! fatal.
END
END; ! write^term.
! This procedure selects (writes to) the destination station.
! If the destination is the supervisor, the write^term
! procedure is called. If the destination is a tributary, a
! message is formatted and written to the tributary.
PROC select (source, array, length);
INT source, length;
STRING .array;
BEGIN
STRING .s;
IF array.<8:15> LAND %337 = "S" THEN ! to supervisor.
BEGIN
! save any terminal completion.
IF NOT term^done THEN term^done := check^term;
CALL CANCEL (termfnum);
CALL write^term (source, array[2], length - 2);
END
ELSE ! destination is a tributary.