EMS Manual
Example of Retrieving Event Messages
EMS Manual—426909-005
A-35
Tracking Earlier Events
FIXED time;
BEGIN
! This procedure builds a command message that sets the
! position within the log file at which the distributor
! will start to retrieve event messages. The calling
! procedure specifies the position by the time parameter,
! which is in Julian-time-stamp format.
! Initialize spi^buf for distributor CONTROL command
spi^err := SSINIT (spi^buf, ZEMS^VAL^BUFLEN,
zems^val^ssid,
ZSPI^VAL^CMDHDR, ZEMS^CMD^CONTROL);
IF spi^err <> ZSPI^ERR^OK THEN
CALL DEBUG;
! Time token will direct the distributor to position
! the log file at messages generated four hours ago
spi^err := SSPUTTKN(spi^buf, ZEMS^TKN^GMTTIME,
time);
IF spi^err <> ZSPI^ERR^OK THEN
CALL DEBUG;
! Send the command message to the distributor
CALL send^spi^cmd;
END;
The spi^cmd^set^position positions the distributor at the event messages generated at
the time specified by the procedure parameter.
To call spi^cmd^set^position from the example, insert these statements in the main
procedure, just before the call to getevent^loop:
! Specify the position within the log files where
! event-message retrieval will begin: four hours ago.
julian^time^stamp :=
JULIANTIMESTAMP ( ) - 14400000000F;
CALL spi^cmd^set^position (julian^time^stamp);
Also, insert this declaration in the dist^intfc (main) procedure:
FIXED julian^time^stamp;
On most active systems, this modification gives you a substantial set of event
messages. Try changing the filter to screen out large numbers of them.
To limit the number of messages displayed at your terminal, change the msglimit
declaration to:
INT msglimit:= 100; ! Set to 100 to represent no limit
This limit provides a reasonable number to page through at your terminal. After finding
100 event messages that pass the filter, the application stops.