Jim,
Actually I doing thru TCL. I thought I found a piece of code, but it is still pulling the whole field instead of data before first separator. Here is what I have so far:
# get the field separator from the hl7 message
set fieldSeparator [crange $msg 3 3]
# get the field from the hl7 message
set OBRsegment [getHL7Segment $msg OBR]
set drNumber [getHL7Field $OBRsegment 16 $fieldSeparator]
set obrFlds [split $OBRsegment $fieldSeparator]
set obr16 [lindex $obrFlds 16]
echo $obr16
set drNumber [crange $drNumber 0 3]
set drNumberList $drNumber
echo drNum:<$drNumber>
Any help?