OSI/AS Management Programming Manual

Event-Retrieval Example
Sample Programs
C–28 056785 Tandem Computers Incorporated
--
-- This procedure returns ZSPI^VAL^TRUE or ZSPI^VAL^FALSE,
-- depending on whether the GETEVENT response contains an
-- error list with the warning token ZEMS^WRN^EOF.
-- TRUE indicates that the distributor has read all event
-- messages up to the present time.
--
-- input - none
-- output - warning
--
-------------------------------------------------------------
INT PROC get^warning;
BEGIN
INT warning;
--
-- Return right away if no error list.
-- If there is no error list, then there cannot be an
-- error token.
--
SSError := EmsGetTkn( Spi^Buffer,
zSpi^Tkn^ErrList,
, -- we don't get a value
1 );
IF ( SSError = zSpi^Err^MisTkn ) THEN
RETURN( zSpi^Val^False )
ELSE IF ( SSError <> zSpi^Err^OK ) THEN
CALL Debug;
--
-- Error list found; now retrieve error token and look
-- for an EOF warning code as a stop request.
--
SSError := EmsGetTkn( Spi^Buffer,
zSpi^Tkn^Error,
SPI^Error,
1 );
IF ( SSError <> zSpi^Err^OK ) THEN
CALL Debug
ELSE IF ( SPI^Error.z^error = zEms^Wrn^EOF ) THEN
warning := zSpi^Val^True
ELSE
warning := zSpi^Val^False;
--
-- Read end-list token to get out of error list.
--
SSError := EmsGetTkn( Spi^Buffer,
zSpi^Tkn^EndList,
, -- we don't get a value
1 );
IF ( SSError <> zSpi^Err^OK ) THEN
CALL Debug;