set field_sep [csubstr $msg 3 1] ;# HL7 field
set sub_sep [csubstr $msg 4 1] ;# HL7 subfield
set fieldList [split $msg $field_sep]
#find pv1 segment
set x 0
set pos 0
while {$x < 1} { set xfield [lindex $fieldList $pos] set xfieldList [split $xfield $sub_sep] set xtype [lindex $xfieldList 0] if {$xtype == “PV1”} incr x } else { incr pos } } set pos [expr {$pos + 17}] set pv1_17 [lindex $fieldList $pos] set subfieldList [split $pv1_17 $sub_sep] set pttype [lindex $subfieldList 0] if {$pttype == $type} { lappend dispList “CONTINUE $msgId” } else { lappend dispList “KILL $msgId” } }