I am having great difficulty accomplishing something that should not be too hard – but, I cannot in the life of me figure out what I am doing wrong.
I need to add a new hard coded OBX segment after the VERY last OBX segment if a condition is met (if $flg is P). I don’t know where or how I should do this? I attempted setting a new variable with the new OBX and added an if condition, but it did not work. So, I have removed it.
The segment to add is :
OBX|$OBX_count||CULTSTAT|||||P[format %c 13]
I have attached the code, and also have a snippet below:
set OBX [lindex $line 3]
set OBXSplit [lindex [split $OBX ^] 0]
set ABFlg [lindex [split [lindex $line 3] ^] 1]
set Flg [lindex [split $ABFlg “*”] 1]
set Flg [string trimright $Flg]
if {$Flg !=”P”} {
append OBXsegs OBX|$OBX_count||||[lindex $line 3][format %c 13]
} else {
append OBXsegs OBX|$OBX_count||||$OBXSplit[format %c 13]
}
incr OBX_count +1
}
incr DSP_count +1
}
}
}
append out OBR|1|$OBR2||$OBR4_1^|||$OBR7|||||||||$physID||||||||$OBR24|$OBR25|[format %c 13]
append out $OBXsegs
return $out
}
Thank you for all your help.