EMS Manual

Example of Retrieving Event Messages
EMS Manual426909-005
A-16
TACL Source File
spi^buf MYAP^TKN^PARAM^CPU [cpu^num]]
[#IF spi^err |THEN|
*** [spi^err] on #SSPUT of CONNECT^SRC^COLL]
== Send the entire buffer to the distributor.
#APPENDV distr_request spi^buf
#EXTRACTV distr_reply spi^buf
[#IF distr_error |THEN|
*** [distr_error] sending CONTROL command]
== Change buffer length to what was declared.
#SET spi^err [
#SSPUT spi^buf ZSPI^TKN^RESET^BUFFER ZEMS^VAL^BUFLEN]
[#IF spi^err |THEN|
*** [spi^err] on #SSPUT of RESET^BUFFER]
== Response is in buffer -- check for return code
#SETMANY spi^err _{count} ems^err &
, [#SSGET /INDEX 1/ spi^buf ZSPI^TKN^RETCODE]
[#IF spi^err |THEN|
*** [spi^err] on #SSGET of RETCODE]
[#IF ems^err |THEN|
*** [ems^err] RETCODE on CONTROL command]
] {spi^control}
== This routine displays the event message ----------------
[#DEF displ^event ROUTINE |BODY| == <event^buf> is param 1
== Adds bell to output to indicate EMPHASIS.
#OUTPUT == Skip a line
[#IF emphasis |THEN| #OUTPUT/HOLD/ [bell]]
== Generated display text from the event message
[#OUTPUT [#EMSTEXT/WIDTH 78 == Displayable line length
,LINES 2/ == Number of display lines
[#REST] ]]
] {displ^event}
== End of displ^event -------------------------------------
== This routine sends and processes GETEVENT requests -----
[#DEF getevent^loop ROUTINE |BODY|
#FRAME
#DEF event^buf STRUCT LIKE zems^ddl^msg^buffer;
#PUSH event_offset
== Initialize spi^buf for GETEVENT command message
#SET spi^err [
#SSINIT spi^buf [zems^val^ssid] ZEMS^CMD^GETEVENT]
[#IF spi^err |THEN|
*** [spi^err] on #SSINIT of GETEVENT command]