But still: the log shows that the result of your ‘set msg_list [split $hl7_ip_rec r]’ is only one element. So either the split command is incorrect (which is doesn’t appear to be) or $hl7_ip_rec doesn’t contain any r.
I would focus on the contents of $hl7_ip_rec just before the split command.
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands