This can be done in a pre-proc. For the subcomponent separator it can also be done in an xltp proc.
The challenge is you will need to know every field where this can happen and apply your logic at each field (whether pre or inside the Xlate).
This is because the characters are valid separators erroneously placed. So if you were to do a ‘globa’l’ replacement pre you would change valid separators as well.
The tilde replacement can be done in an Xlate with no Tcl I would think by using the ITERATE and CONCAT Actions (this assumes thee field in question is not repeating by definition).
If the offending field is a repeating field then the issue gets even tougher (which tilde should really be replaced?). The NTE-3 where I suspect your current issue exists is a repeating field by definition – although perhaps not by local usage.
The real solution lies with the source system. HL/7 has provision for escaping separators imbedded in text. The source system should:
– Use the escape mechanism of the standard
– Stop the user from entering separaators at data entry.
– Provide replacement (and for & approx. for ~) at data entry.
The above can have issues as well if there are potential field length constraints.
email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.