EMS Manual

Example of Retrieving Event Messages
EMS Manual426909-005
A-11
TAL Source File
WHILE msgcount < msglimit OR msglimit = 0 DO
BEGIN
msgcount := msgcount + 1;
! Send GETEVENT command message to the distributor
CALL send^spi^cmd;
! Find the event message within the GETEVENT response
tkn := ZEMS^TKN^EVENT;
spi^err := SSGETTKN ( spi^buf, ZSPI^TKN^ADDR,
tkn, 1,
@event^buf);
IF spi^err <> ZSPI^ERR^OK THEN
CALL DEBUG;
! Move past the length part (variable length token)
@event^buf := @event^buf + 2D;
! Display the event message at your terminal
CALL displ^event(event^buf);
! Save CONTEXT token from this GETEVENT response
! message for the next GETEVENT command message
spi^err := SSMOVETKN(ZSPI^TKN^CONTEXT,
spi^buf, 1, ! Source
sav^buf, 1); ! Destination
IF spi^err <> ZSPI^ERR^OK THEN
CALL DEBUG;
! Move the updated command to spi^buf for next time
! through the loop
spi^buf ':=' sav^buf FOR $LEN(spi^buf) BYTES;
END; ! WHILE
END;
?PAGE
PROC dist^intfc MAIN;
BEGIN
! This MAIN procedure starts a distributor and calls
! procedures that use command messages to connect a
! source collector and to load a filter. Then the
! procedure calls the getevent^loop procedure to retrieve
! and process event messages.
! Initialize subsystem IDs
zems^val^ssid ':=' [ZSPI^VAL^TANDEM,
ZSPI^SSN^ZEMS,
ZEMS^VAL^VERSION];
myap^val^ssid ':=' [MYAP^VAL^OWNER,
MYAP^SSN^MYAP,
MYAP^VAL^VERSION];
! Get terminal name and open terminal