EMS Manual

Example of Reporting Events
EMS Manual426909-005
B-12
The TACL Source File
*** #SSPUTV error: [ems^err]
]
== Add a "ZEMS^TKN^TEXT" token in the buffer.
== The format is the string length followed by the actual string.
== Since the first character in evt^txt is not numeric, we can use
== [#CHARCOUNT evt^txt][evt^txt] for the ZEMS^TKN^TEXT token value.
#SET evt^txt I/O on [#IN] took [#COMPUTE [IO^TIME]/1000000] &
seconds to complete!
#SET ems^err [#SSPUT /SSID [ems^ssid]/
event^buf ZEMS^TKN^TEXT [#CHARCOUNT evt^txt][evt^txt]]
[#IF ems^err |THEN|
*** #SSPUT error: [ems^err]
]
== Send the event to the collector
#APPENDV coll^req event^buf
#EXTRACTV coll^reply event^buf
[#IF coll^err |THEN|
*** Error on sending the event to [coll^name]: [coll^err]
]
#output "Time^too^long" event message sent to [coll^name]!
] == end of DEF too^long
==========================================================================
=== This is the main program ===
== Start an alternate collector
[#IF NOT [#PROCESSEXISTS [coll^name]] |THEN|
$system.system.emsacoll /name [coll^name], nowait/ logsubvol [log^subvol]
]
== Start a requester that will writeread (READ means WRITEREAD) events
== to a collector.
#SET coll^err [#REQUESTER /WAIT [zems^val^buflen]/ READ [coll^name]
coll^err coll^reply coll^req]
[#IF coll^err |THEN|
#OUTPUT *** Opening collector [coll^name] error: [coll^err]
]
#SET #INPUTEOF 0
[#LOOP |WHILE| NOT [#INPUTEOF] |DO|
#SET start^io [#JULIANTIMESTAMP]
== Accept input
#SET in^msg [#INPUT ?]
#SET end^io [#JULIANTIMESTAMP]
#SET io^time [#COMPUTE [end^io] - [start^io]]
#SET io^calls [#COMPUTE [io^calls] + 1]
== If more than 10 seconds were used since last input, then generate an
== event.
[#IF io^time > 10000000 |THEN| == io^time > 10 seconds
too^long
]
]
#UNFRAME