Envoy Application Programming Manual

Table Of Contents
BISYNC Multipoint Tributary Protocol
Envoy Application Programming Manual427159-001
5-41
Programming Examples
Example 5-15. Program Code for BISYNC Multipoint Tributary (Page 2 of 7)
STRING
.saddr^list[ 0 : addr^size * num^entries * 2 - 1] :=
[no^poll + "P","A", ENQ, 0, ! entry 0, station 0 poll.
"Sa", ENQ, 0]; ! entry 1, station 0 select.
INT .addr^list := @saddr^list ’>>’ 1;
?NOLIST
?SOURCE $SYSTEM.SYSTEM.EXTDECS (ABEND, AWAITIO, CANCEL,
? CHANGELIST, CLOSE, DEBUG,
? DEFINELIST, DELAY, FILEERROR,
? FILEINFO, OPEN, READ, STOP,
? WRITE, WRITEREAD)
?LIST
! This procedure checks the line for a completion. The
! following values are returned:
!
! 0 = no completion.
! 1 = station selected (message received).
! 2 = station polled
! 3 = line error.
INT PROC check^line;
BEGIN
INT error;
CALL AWAITIO (linefnum,,linelen,,0D);
IF = THEN ! selected ! RETURN 1;
CALL DELAY (200D);
CALL FILEINFO (linefnum, error);
IF error = 40 THEN RETURN 0; ! no completion.
IF error = 166 THEN RETURN 2; ! polled.
RETURN 3; ! other error.
END; ! check^line.
! This procedure checks the terminal for a completion. The
! following values are returned:
!
! 0 = no completion.
! 1 = completion.
! 2 = end of file.
! 3 = recoverable error occurred.
! 4 = nonrecoverable error occurred.