Following is tps routin I want to use to do this.
errorFile
and gets closed during shutdown
My problem is that RUN part of my routine doesn’t recognize myfileID defined in START
Can anybody tell me please what I do wrong?
Or may be it is another way how to do it?
Thanks
proc FilterParse { args } {
package require medisyslib
global HciSiteDir
set errorFile $HciSiteDir/exec/processes/kicout/IBfiles/picisChgError.txt
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
set myfileID [ open $errorFile APPEND ]
}
run {
keylget args MSGID mh
set msg [msgget $mh]
set fieldsep [ crange $msg 3 3 ]
set segmlist [ split $msg r ]
set mshSegm [ getSegment $segmlist “MSH” ]
set mshFieldList [ split $mshSegm $fieldsep ]
set facility [ lindex $mshFieldList 3 ]
if { [ cequal $facility “JHMC” ] } {
lappend dispList “CONTINUE $mh”
} else {
msgwrite raw $mh $myfileID
lappend dispList “KILL $mh”
}
}
time {
# N.B.: there may or may not be a MSGID key in args
}
shutdown {
# Doing some clean-up work
close $myfileID
}
}
return $dispList