6100 MPS-B Programming Manual

6100 MPS-B PROGRAMMING EXAMPLE
The code for the BROADCAST procedure is as follows:
?PAGE "PROCEDURE: BROADCAST"
PROC broadcast;
BEGIN
INT retry^count := 0;
slinebuff ’:=’ [ EOT ] & [ "11s22s33s" ] & [ STX ]
& [ "SYSTEM IS UP" ] & [ ETX ] -> @sp;
req^buff.text [2] ’:=’ slinebuff FOR
(buff^len := @sp ’-’ @slinebuff);
DO
BEGIN
! Call "request" to assemble, and issue, the appropriate
! WRITEREAD request to broadcast the message to the
! terminals. Text Out includes the message length plus
! the mcw (2).
CALL request (write^line,fast^select,(buff^len + 2 ));
IF status <> 0 THEN
BEGIN
IF retry^count = max^retries THEN CALL error^exit;
! If the operation fails "max^retries" times, then ABEND.
retry^count := retry^count + 1;
END
END
UNTIL status = 0;
END; ! of broadcast.
B-19