› Clovertech Forums › Read Only Archives › Cloverleaf › Tcl Library › TCL Proc Kill message if not equal to "RESULTOUTASCII&a
The most non-ergomic package you can use is the HL7 package floating around out there. It saves you maybe one command but parses the HL7 message every time
set fldSep [string index $msg 3]
set SEGMENTS [split $msg r]
set msh8 [lindex [split [lindex $SEGMENTS 9] $fldSep] 7]
set OBR [split [lsearch -inline -regexp $SEGMENTS {^OBR}] $fldSep]
set obr24 [lindex $OBR 24]
if {$msh8 ne “RESULTOUTASCII” && $obr24 ne “HEN”} {
return “{KILL $mh}”
} else {
return “{CONTINUE $mh””
}
How much did you save with the HL7 package?
I correct my TCL proc to be. But now I am getting a 302 error
#####################################################################
# Name: tpsKillMSH8_Sentri7
# Purpose: Kill all messages not equal to “RESULTOUTASCII” in MSH.8
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (“start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
proc tpsKillMSH8_Sentri7 { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set MSH_8 “”
set OBR_24 “”
set msg [msgget $mh]
set fieldSeparator [crange $msg 3 3]
set subFieldSeparator [crange $msg 4 4]
set repChar [crange $msg 5 5]
set escChar [crange $msg 6 6]
set subCompSeparator [crange $msg 7 7]
set fldSep [string index $msg 3]
set SEGMENTS [split $msg r]
set msh8 [lindex [split [lindex $SEGMENTS 9] $fldSep] 7]
set OBR [split [lsearch -inline -regexp $SEGMENTS {^OBR}] $fldSep]
set obr24 [lindex $OBR 24]
if {$msh8 ne “RESULTOUTASCII” && $obr24 ne “HEN”} {
return “{KILL $mh}”
} else {
return “{CONTINUE $mh””
}
}
return $dispList
}
}
if you get rid of all the superflous code like:
set MSH_8 “”
set OBR_24 “”
set msg [msgget $mh]
set fieldSeparator [crange $msg 3 3]
set subFieldSeparator [crange $msg 4 4]
set repChar [crange $msg 5 5]
set escChar [crange $msg 6 6]
set subCompSeparator [crange $msg 7 7]
return $dispList, etc. what do you get.
Hard to troubleshoot with all the junk 🙂
#####################################################################
# Name: tpsKillMSH8_Sentri7
# Purpose: Kill all messages not equal to “RESULTOUTASCII” in MSH.8
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (“start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
proc tpsKillMSH8_Sentri7 { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set fldSep [string index $msg 3]
set SEGMENTS [split $msg r]
set msh8 [lindex [split [lindex $SEGMENTS 9] $fldSep] 7]
set OBR [split [lsearch -inline -regexp $SEGMENTS {^OBR}] $fldSep]
set obr24 [lindex $OBR 24]
if {$msh8 ne “RESULTOUTASCII” && $obr24 ne “HEN”} {
return “{KILL $mh}”
} else {
return “{CONTINUE $mh””
}
}
}
}
[nci :nci :ERR /0: hlab_cmd:05/14/2013 07:18:38] Check NetConfig error – error list:
to_empower_inp_hlab Protocol PDL TCP/IP Host: cannot find host ’empsvr2′
sfbi_standard_in Protocol PDL TCP/IP: PDLTYPE ‘tcp-client’ is not ‘tcp-server’
to_empower_inp Protocol PDL TCP/IP Host: cannot find host ’empsvr2′
to_hboc_orders Protocol PDL TCP/IP Host: cannot find host ‘starcln’
to_hboc_orm_dft Protocol PDL TCP/IP Host: cannot find host ‘starcln’
fr_prosolv_in Protocol PDL TCP/IP: PDLTYPE ‘tcp-client’ is not ‘tcp-server’
vitals_isirona_adt Protocol PDL TCP/IP Host: cannot find host ‘msmcvitalsrv01’
to_hboc_pha_hlab Protocol PDL TCP/IP Host: cannot find host ‘starcln’
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:19:10] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:19:28] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[pdl :PDL :ERR /0:auditlogix_adt:05/14/2013 07:19:47] read failed: Unknown error
[pdl :PDL :ERR /0:auditlogix_adt:05/14/2013 07:19:47] read returned error 0 (No error)
[pdl :PDL :ERR /0:auditlogix_adt:05/14/2013 07:19:47] PDL signaled exception: code 1, msg device error (remote side probably shut down)
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:19:58] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:04] [0.0.494390656] unknown segment ‘PD1’ — ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:05] [0.0.494390656] unknown segment ‘ZOE’ — ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:05] [0.0.494390656] unknown segment ‘ZPI’ — ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:05] [0.0.494390656] unknown segment ‘ZPV’ — ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:05] [0.0.494390656] unknown segment ‘ZIN’ — ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:05] [0.0.494390656] The # 23 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A01’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:19] [0.0.494390691] The # 3 segment encountered ‘PD1’ is not defined for message type ‘ADT_A01’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:19] [0.0.494390691] The # 19 segment encountered ‘ZPI’ is not defined for message type ‘ADT_A01’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:19] [0.0.494390691] The # 20 segment encountered ‘ZPV’ is not defined for message type ‘ADT_A01’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:19] [0.0.494390691] The # 21 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A01’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:20:19] [0.0.494390691] The # 22 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A01’. Segment ignored.
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:20:54] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:27] [0.0.494390865] The # 3 segment encountered ‘PD1’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:27] [0.0.494390865] The # 19 segment encountered ‘ZPI’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:27] [0.0.494390865] The # 20 segment encountered ‘ZPV’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:27] [0.0.494390865] The # 21 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:27] [0.0.494390865] The # 22 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:27] [0.0.494390865] unknown segment ‘ZAB’ — ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:58] [0.0.494391104] The # 3 segment encountered ‘PD1’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:58] [0.0.494391104] The # 27 segment encountered ‘ZPI’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:58] [0.0.494391104] The # 28 segment encountered ‘ZPV’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:58] [0.0.494391104] The # 29 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:21:58] [0.0.494391104] The # 30 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:08] [0.0.494391167] The # 3 segment encountered ‘PD1’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:08] [0.0.494391167] The # 27 segment encountered ‘ZPI’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:08] [0.0.494391167] The # 28 segment encountered ‘ZPV’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:08] [0.0.494391167] The # 29 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:08] [0.0.494391167] The # 30 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:22] [0.0.494391269] The # 3 segment encountered ‘PD1’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:22] [0.0.494391269] The # 27 segment encountered ‘ZPI’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:22] [0.0.494391269] The # 28 segment encountered ‘ZPV’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:22] [0.0.494391269] The # 29 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:22] [0.0.494391269] The # 30 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:25] [0.0.494391334] The # 3 segment encountered ‘PD1’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:25] [0.0.494391334] The # 19 segment encountered ‘ZPI’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:25] [0.0.494391334] The # 20 segment encountered ‘ZPV’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:25] [0.0.494391334] The # 21 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:25] [0.0.494391334] The # 22 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:25] [0.0.494391334] The # 23 segment encountered ‘ZAB’ is not defined for message type ‘ADT_A08’. Segment ignored.
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:26] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:26] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:27] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:28] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:28] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:29] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:29] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:29] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:29] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:30] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:30] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:30] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:31] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:31] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:31] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:32] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:32] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:32] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:33] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:33] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:33] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:34] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:34] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:34] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:35] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:35] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:35] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[xlt :xlat:ERR /0: hlab_xlate:05/14/2013 07:22:36] Tcl error:
msgId = message0
proc = ‘tpsKillMSH8_Sentri7’
args = ”
result = ‘invalid command name “tpsKillMSH8_Sentri7″‘
errorInfo: ‘
invalid command name “tpsKillMSH8_Sentri7”
while executing
“tpsKillMSH8_Sentri7 {MSGID message0} {CONTEXT xlt_pre} {ARGS {}} {MODE run} {VERSION 3.0}”‘
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:43] [0.0.494391696] The # 3 segment encountered ‘PD1’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:43] [0.0.494391696] The # 27 segment encountered ‘ZPI’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:43] [0.0.494391696] The # 28 segment encountered ‘ZPV’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:43] [0.0.494391696] The # 29 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
[msg :RecP:WARN/0: hlab_xlate:05/14/2013 07:22:43] [0.0.494391696] The # 30 segment encountered ‘ZIN’ is not defined for message type ‘ADT_A08’. Segment ignored.
Should the index of the MSH segment in SEGMENTS be 0 rather than 9?
++++
set fldSep [string index $msg 3]
set SEGMENTS [split $msg r]
set msh8 [lindex [split [lindex $SEGMENTS 0] $fldSep] 7]
set OBR [split [lsearch -inline -regexp $SEGMENTS {^OBR}] $fldSep]
set obr24 [lindex $OBR 24]
if {$msh8 ne “RESULTOUTASCII” && $obr24 ne “HEN”} {
return “{KILL $mh}”
} else {
return “{CONTINUE $mh””
}
#####################################################################
# Name: tpsKillMSH8_Sentri7
# Purpose: Kill all messages not equal to “RESULTOUTASCII” in MSH.8
# or all messages not equal to “HEM” in OBR.24
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (“start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
proc tpsKillMSH8_Sentri7 { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set fldSep [string index $mh 3]
set SEGMENTS [split $mh r]
set msh8 [lindex [split [lindex $SEGMENTS 9] $fldSep] 7]
set OBR [split [lsearch -inline -regexp $SEGMENTS {^OBR}] $fldSep]
set obr24 [lindex OBR 23]
echo OBR 24 is > $obr24 <
if {$msh8 ne “RESULTOUTASCII” || $obr24 ne “HEM”} {
return “{KILL $mh}”
} else {
return “{CONTINUE $mh}”
}
}
}
}
the TCL is not pick up the OBR segment
The code is correct although the indices may need to be fixed.
index of OBR 23 will give you the 23rd field because the segment name, OBR, has the zero index. So the “set id” field has the index 1, etc.
Here is the TCL that worked
#####################################################################
# Name: tpsKillMSH8_Sentri7
# Purpose: Kill all messages not equal to “RESULTOUTASCII” in MSH.8
# or all messages not equal to “HEM” in OBR.24
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (“start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
proc tpsKillMSH8_Sentri7 { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set msg [msgget $mh]
#echo MSG = $msg
set fldSep [string index $msg 3]
#echo fldSep = $fldSep
set SEGMENTS [split $msg r]
#echo SEG = $SEGMENTS
set msh8 [lindex [split [lindex $SEGMENTS 9] $fldSep] 7]
#echo MSH8 = $msh8
set OBR [split [lsearch -inline -regexp $SEGMENTS {^OBR}] $fldSep]
#echo OBR = $OBR
set obr24 [lindex $OBR 24]
#echo OBR 24 is >$obr24<
if {$msh8 ne “RESULTOUTASCII” || $obr24 ne “HEM”} {
return “{KILL $mh}”
} else {
return “{CONTINUE $mh}”
}
}
}
}