EMS Manual

Generating Standard Events
EMS Manual426909-005
10-29
Task 10.3: Send Your Event Message Buffer to the
EMS Collector
Task 10.3: Send Your Event Message Buffer to the EMS Collector
After building your event message buffer, send it to the EMS collector:
1. Call the SPI SSGETTKN procedure to obtain the length of your event message
buffer, which is saved in ZSPI-TKN-USEDLEN. For details, see the SPI
Programming Manual.
2. Call the WRITEREAD procedure to send the event message buffer to the open
collector. Use the number of bytes to write from the SSGETTKN procedure.
Design your code to handle these errors returned from the WRITEREAD call:
Error 33—EMS collector has no buffer space
This is a temporary condition. Wait a second and then reissue the
WRITEREAD.
Error 60—wrong ID
The EMS collector has been restarted since you opened it. Close the collector,
reopen it, and issue the WRITEREAD again.
3. If needed, call the FILE_CLOSE_ procedure to close the EMS collector process
after each event message.
If you have many event messages to send, leave the collector open to avoid
opening and closing the collector for each event message. The alternate collector
can handle a finite, but large, number of openers, so you might not want to keep
the alternate collector open for a long period of time. The primary collector can
handle any number of openers.
Task 10.4: Compile Your EMS Code
Include, in order, the definitions of:
The standard SPI tokens
The standard EMS tokens
The tokens of other subsystems you depended on (if any)
ZEMS-TKN-CONTENT-
USER
ZEMS-VAL-NULL unless specified by the corresponding
optional parameter in the
EMS_COMMON_TOKENS_EVT_BLD_ procedure
ZEMS-TKN-EMPHASIS ZSPI-VAL-FALSE unless specified by the corresponding
optional parameter in the
EMS_COMMON_TOKENS_EVT_BLD_ procedure
ZEMS-TKN-SUPPRESS-
DISPLAY
ZSPI-VAL-FALSE
Required Common Token Default Value (page2of2)