Distributed Name Service (DNS) Management Programming Manual
Retrieving and Decoding Event Messages
SPI Programming Considerations for DNS
46958 Tandem Computers Incorporated 3–11
Retrieving and
Decoding Event
Messages
The following is a summary of the steps your application must take to retrieve and act
upon event messages:
1. Declare a buffer of appropriate size for the Event Management Service (EMS)
GETEVENT command and its response. (For recommended sizes, see the event-
management considerations subsection that follows.)
2. Start an EMS consumer distributor and open it with the #ZSPI qualifier on the
process name.
3. Format an EMS distributor CONTROL programmatic command to load a filter
you have written, and to specify the source and destination of event messages, if
desired. (The filter selects which event messages you wish your application to
process. Filters are discussed further at the end of this section.) Send the
CONTROL command to the consumer distributor, using the mechanism
appropriate to your programming language (for example, a WRITEREAD call in
TAL).
4. Read the response from the distributor, using the mechanism appropriate to your
programming language (for example, a WRITEREAD call in TAL).
5. Repeat the following steps in a loop:
a. Format and send a GETEVENT command to the consumer distributor to get
the next event message, using the mechanism appropriate to your
programming language (for example, a WRITEREAD call in TAL).
b. Read the response from the distributor, using the mechanism appropriate to
your programming language (for example, a WRITEREAD call in TAL).
c. Call SSMOVE or SSMOVETKN to move the context token from the response
buffer into the GETEVENT command buffer. The context token will be
needed later, when your application resends the command to get the next
event message.
d. Call SSGET or SSGETTKN to retrieve the token containing the event message
(ZEMS-TKN-EVENT) from the response buffer.
e. Call EMSGET or EMSGETTKN to retrieve the subsystem ID (ZSPI-TKN-SSID)
and the event number (ZEMS-TKN-EVENTNUMBER) from the event
message. Together, these two tokens identify the event message and
determine what information tokens it contains.
f. Call EMSGET or EMSGETTKN twice to retrieve the subject of the event
message. In the first call, retrieve the subject-mark token (ZEMS-TKN-
SUBJECT) to get the token code and index of the token identifying the subject.
Then make another call to retrieve the subject token itself.
g. Call EMSGET or EMSGETTKN to retrieve the values of other tokens from the
event message.