A couple of things. The method James suggested,
set finalmsgf [join “$mshs $PIDsegmentall $PV1segmentall $restmsg” r]
leaves off the trailing r and strips out the from the MSH segment, at least in my testing using hcitcl. I’m guessing the latter is a result of the fact that is an escape character.
For Dave’s dillemma, I’m not sure why the r is not being included with the concat command, but if you use the cconcat command, which I tried, you do get the r at the end of the result.
Both
set finalmsgf [cconcat $mshsr$PIDsegmentallr$PV1segmentallr$restmsgr]
and
set finalmsgf [cconcat $mshs “r” $PIDsegmentall “r” $PV1segmentall “r” $restmsg”r”]
Gave the final message with trailing x0d character.
The only difference I could see regarding concat and cconcat in the help was that concat will eliminate any leading or trailing spaces. Perhaps its treating the final “r” as white space and eliminating it.
Hope this helps.
Bob
Robert Milfajt
Northwestern Medicine
Chicago, IL