Envoy Application Programming Manual

Table Of Contents
BISYNC Centralized Multipoint Supervisor Protocol
Envoy Application Programming Manual427159-001
4-54
Programming Examples
Example 4-20. Program Code for Poll and Select Procedures (Page 6 of 7)
BEGIN
IF poll THEN
BEGIN ! a station responded to the
! poll.
no^responder := 0;
CALL select (linebuf + 1,slinebuf[5],
linelen - 6);
END
ELSE
! no response to poll, check terminal
! for completion.
IF (term^done := check^term) THEN
no^responder := 0;
CASE term^done OF
BEGIN
! 0 ! ;
! no completion.
! 1 ! IF termlen THEN ! completion.
! 1 ! CALL select (0,termbuf,termlen);
! 2 ! done := 1; ! end-of-file.
! 3 ! ; ! retry error.
! 4 ! CALL abend; ! fatal error.
END;
END; ! while no^responder loop.
END; ! while not done loop.
END; ! doit.
PROC example MAIN;
BEGIN
INT .buf[0:66], ! general purpose buffer.
count;
! read the start-up message to identify home terminal.
buf ':=' ["$RECEIVE", 8 * [" "]];
CALL OPEN (buf,count);
CALL READ (count,buf,66);
CALL CLOSE (count);
! open the home terminal for use by the application.
CALL OPEN (buf[9], termfnum, 1); ! nowait.
IF < THEN CALL ABEND;
! open the line.
CALL OPEN (buf[21], linefnum);
IF < THEN CALL ABEND;