EMS Manual
Example of Retrieving Event Messages
EMS Manual—426909-005
A-8
TAL Source File
IF ( ( ERROR = 0 ) AND ( CPU^NUM >= 0 ) ) THEN
got^it := true;
END; ! WHILE
END;
?PAGE
PROC send^spi^cmd;
BEGIN
! This procedure accepts, in spi^buf, a command message
! prepared by another procedure, such as the
! spi^cmd^set^source procedure, below. The
! send^spi^cmd procedure sends the command message to
! the distributor and checks the response message.
! Determine how much of buffer has been used
spi^err := SSGETTKN(spi^buf, ZSPI^TKN^USEDLEN,
used^len);
IF spi^err <> ZSPI^ERR^OK THEN
CALL DEBUG;
! Send the used part to the distributor
CALL WRITEREAD(distr, spi^buf, used^len,
ZEMS^VAL^BUFLEN);
IF <> THEN
CALL DEBUG;
! Reset buffer length to what you declared for spi^buf
spi^err := SSPUTTKN(spi^buf,
ZSPI^TKN^RESET^BUFFER,
ibuflen);
IF spi^err <> ZSPI^ERR^OK THEN
CALL DEBUG;
! Response is in buffer--check for return code
spi^err := SSGETTKN(spi^buf, ZSPI^TKN^RETCODE,
ems^err, 1);
IF spi^err <> ZSPI^ERR^OK THEN
CALL DEBUG;
IF (ems^err) THEN
CALL DEBUG;
END;
?PAGE
PROC spi^cmd^set^source;
BEGIN
! This procedure builds a command message that directs
! the distributor to use a collector as a source of
! event messages.
! Initialize spi^buf for distributor CONTROL message
spi^err := SSINIT (spi^buf, ZEMS^VAL^BUFLEN,
zems^val^ssid,