OK I have not tested this thoroughly but here is a concept:
You are going to need Tcl for this.
1. COPY the ib OBX-5 field to the ob OBX-5 field using a Tcl proc to regsub all Upper Case to Upper Case plus whatever your component separator (typically ~) is. Such that AbcdefGhijk might become Abcdef~Ghijk.
2. Iterate over the ob (OUTBOUND) OBX-5 you just created at the field level using the ob OBX-5 as a basis for the iteration. Use something like %f1 for the counter
3. COPY the ob OBX-5 field with a properly placed %f1 to the ob OBX-5 where the %f1 becomes your segment or group counter on the destination.
Last you might need to accomodate for the first OBX segment’s OBX-5 having the entire string.
Just an idea and if you want to pursue it further, email me.
Maybe someone can propose a regsub pattern which would work – I have not thought that through.
Jim Kosloskey
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.