Sam,
I just want to use a tcl to do this. I am almost close but some how missing something. Here is the code so far:
*****************************************************
set Fld_Sep [cindex $msg 3]; # Field Separator “|”
set Com_Sep [cindex $msg 4]; # Component Separator “^”
set Rep_Sep [cindex $msg 5]; # Repetition Separator “~”
set Esc_Chr [cindex $msg 6]; # Escape Character “”
set Sub_Sep [cindex $msg 7]; # Subcomponent Separator “&”
set Seg_List [split $msg r]
set New_Seg_List “”
foreach Segment $Seg_List {
set Seg_ID [crange $Segment 0 2]
if { ($Seg_ID == “OBX”) } {
set Field_List [split $Segment $Fld_Sep]
set Result_Value [lindex $Field_List 5]
if { ([regexp “^ *$” $Result_Value]) } {
set Segment “”
}
set New_Seg_List [lappend New_Seg_List $Segment]
}
set msg [join $New_Seg_List r]
# Replace message with new one created.
msgset $mh $msg
}
************************************************
The above code, somehow, is spitting only the segments I want to remove!
Any ideas?
Arslan