The $hmsId is an argument. For this facility it is 018. I also pad the original 3 digit number with zeros up to 5 by calling the x_prepenZeros proc.
My output in PV1-9 looks like this:
01800229^TEST^CHAD^J~400^BALASUBRAMANIAN^LAKSHMI~727^BABBAR^HARSH
Here is my current code:
# Consulting Doc
set pv1_9 [lindex $fields 9]
set pv1_9_list [split [lindex $fields 9] $sub_sep]
set DocNumber_9_0 [lindex $pv1_9_list 0]
if {$DocNumber_9_0 != “”} {
set nDocNum [x_prepenZeros 5 $DocNumber_9_0]
set replaceDocNum “”
append replaceDocNum $hmsId $nDocNum
set pv1_9 [join [lreplace $pv1_9_list 0 0 $replaceDocNum] $sub_sep]
set fields [lreplace $fields 9 9 $pv1_9]
}
What am I missing that would continue the same code into the repeating portion of the field.
Any help is greatly appreciated.