EMS Manual
Example of Retrieving Event Messages
EMS Manual—426909-005
A-22
COBOL Source File
* Place the filter-parameter token in the buffer
ENTER "SSPUT" USING distr-rec, myap-tkn-param-cpu
cpu-num, OMITTED, myap-val-ssid GIVING error-flag
IF error-flag NOT = ZERO
ENTER "DEBUG"
END-IF
* Send command message to distributor and get response
READ distr-process
WITH PROMPT distr-rec AT END ENTER "DEBUG"
END-READ
* Protect against a longer buffer in the distributor
ENTER "SSPUT" USING distr-rec, zspi-tkn-reset-buffer,
zems-val-buflen GIVING error-flag
IF error-flag NOT = ZERO
ENTER "DEBUG"
END-IF
* Response is in buffer - check for return code
ENTER "SSGET" USING distr-rec, zspi-tkn-retcode,
ems-err, 1 GIVING error-flag
IF error-flag NOT = ZERO
ENTER "DEBUG"
END-IF
IF ems-err NOT = ZERO
ENTER "DEBUG"
END-IF
* Send GETEVENT commands and display event messages
PERFORM getevent-loop
CLOSE distr-process
STOP RUN
.
getevent-loop.
* Initialize distr-rec for GETEVENT command message
ENTER "SSINIT" USING distr-rec, zems-val-buflen,
zems-val-ssid, zspi-val-cmdhdr, zems-cmd-getevent
GIVING error-flag
IF error-flag NOT = ZERO
ENTER "DEBUG"
END-IF
* Save the original command
MOVE distr-rec TO save-buf
PERFORM WITH TEST AFTER UNTIL end-of-loop
* Send GETEVENT command to the distributor and get response
READ distr-process WITH PROMPT distr-rec
AT END ENTER "DEBUG"
END-READ