NetBatch Management Programming Manual
SPI Programming Considerations for the NetBatch
Subsystem
NetBatch Management Programming Manual—522462-003
3-13
Retrieving and Decoding Event Messages
Retrieving and Decoding Event Messages
For detailed information on event-message retrieval and decoding, and for examples of
event-message retrieval in the C, COBOL, TACL, and TAL languages, see the EMS
Manual.
To retrieve and decode event messages from the NetBatch subsystem:
1. Declare a buffer of appropriate size for the EMS GETEVENT command and its
response. For recommended buffer sizes, see the EMS Manual.
2. Start an EMS consumer distributor and open it specifying the #ZSPI qualifier in the
process name.
3. Perform these tasks:
a. 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. (You use filters to select the event messages you want your
application to process. Filters are discussed further at the end of this section.)
b. Send the CONTROL command to the consumer distributor, using the
mechanism applicable to your programming language (for example, Guardian
procedure WRITEREADX for C and TAL, the READ verb for COBOL, or the
#REQUESTER built-in function for the TACL program).
4. Read the response from the distributor, using the mechanism applicable to your
programming language.
5. For each event message:
a. Format and send a GETEVENT command to the consumer distributor to get
the next event message, using the mechanism applicable to your programming
language.
b. Read the response from the distributor, using the mechanism applicable to
your programming language.
c. Call procedure SSMOVE or SSMOVETKN to move the context token from the
response buffer into the GETEVENT command buffer. The context token will
be required later, when your application resends the command to get the next
event message.
d. Call procedure SSGET or SSGETTKN to retrieve the token containing the
event message (ZEMS-TKN-EVENT) from the response buffer.
e. Call procedure 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 procedure EMSGET or EMSGETTKN twice to retrieve the subject of the
event message. In the first call, retrieve the subject-mark token (ZEMS-TKN-