Once you decide you need to use your own outbound counter (in this case because you need to add an OBX), you should use the %g99 on the outbound all the time. I see you are using the counter some of the time.
So my suggestion is to change all of your outbound references to the OUTBOUND OBX group from %g1 (the Xlate’s counter) to %g99 (your counter).
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Repost the current logic and if you can the first 61 OBX of the inbound and what the outbound looks like.
One thing to note is you are using %g99 as the Set ID – however %g99 is relative to zero but typically Set IDs are relative to one. So when your @line_cnt equals 60 your %g99 will have the value of 59 and your Set ID in the resultant OBX will be 59. Perhaps this is misleading you into thinking you have replaced. Check to see if your first outbound OBX Set ID is zero.
My suggestion (even if this is not the issue) is to use a MATH ADD $%g99 =1 –> OBX-1.
If you want to you can email me directly and we can work on this off line.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.