• I have been doing healthcare EDI processing for a mere eight years, but that's long enough to say that not all such work is complicated. I will agree that you shouldn't attempt even the simple ones without some familiarity with the IG.

    I was once tasked to do something similar to what he asked. I did not use SSIS, because it was only one file per day. If there were many files, I would drop the code into a script component and put a foreach task around it.

    Instead of looping though segments and having to keep track of the entire complicated structure, I inserted markers at easy-to-find points of interest (beginning of a claim, SE segment, etc.). SPLIT the entire file on the markers, and each piece can be manipulated without having to keep track of overall file structure (other than counting any segments added or removed, to update the next SE). JOIN the updated pieces back into a single string, and write it to the output file.