EMS Manual
Retrieving Event Messages Programmatically
EMS Manual—426909-005
4-13
Obtaining an Event Message (GETEVENT)
only carry it forward to the next GETEVENT command message. You do not need
to examine the token.
You must not include the context token when its contents are not valid—that is,
when the distributor has just been opened and no message has been returned yet
or when a log-file positioning operation has just been performed. For all other
GETEVENT command messages, you can include the context token you received
from the previous GETEVENT response message. Use of the context token is
optional. However, once a context token is submitted, subsequent messages must
also contain it.
ZEMS^TKN^EOFSTOP (nonshared). If the distributor is accessing current collector
logs, this parameter lets you specify that you do not want to wait for the next
incoming message when you have reached the end of the log file. If you set
EOFSTOP to TRUE and there are no further event messages to return, the
distributor returns an end-of-file warning in the response. The
ZSPI^TKN^RETCODE is zero and, in the accompanying error list, the z^error field
of ZSPI^TKN^ERROR is ZEMS^WRN^EOF.
If you set EOFSTOP to FALSE (or omit it) and there are no further event messages
to return, the distributor does not respond to the GETEVENT command message
until the collector has logged a new event message.
This parameter is ignored if the distributor is accessing a saved log file.
This example uses GETEVENT to retrieve two event messages. No CONTEXT token
is included in the first GETEVENT because it is the first one issued since the distributor
was opened. But the second GETEVENT command message includes the CONTEXT
token from the response to the first one.
! Build a GETEVENT command message that includes EOFSTOP
! but excludes CONTEXT.
! Initialize spibuffer for GETEVENT command message
IF (error := SSINIT(spibuffer,
ZEMS^VAL^BUFLEN,
ZEMS^VAL^SSID,
ZSPI^VAL^CMDHDR,
ZEMS^CMD^GETEVENT)) THEN ...
! Place token--with token value--in spibuffer
eofstopvalue := ZSPI^VAL^TRUE;
spi^error := SSPUTTKN(spibuffer,
ZEMS^TKN^EOFSTOP,
eofstopvalue);
! Handle any error from SPI procedure
IF spi^error <> ZSPI^ERR^OK THEN ...