>>If we move the first do case into the end of the loop, we would not need to execute it outside of the loop.
>
>I don't see it. When you encounter a new message (code = "MSH") you know have have finished the previous one. How can you know the last message has been processed when the code isn't "MSH"
I think I'm not following the logic now at all. The only thing I know is we have to somehow process the last record inside the loop, so we don't need to repeat SendCompleteMessage outside.
How can we do it I'm not sure.
If it's not broken, fix it until it is.
My Blog