I understand your question now. There is nothing wrong with doing something inside the loop, and then having to do the same thing outside the loop to take care of the last complete message. Now, personally, I prefer to do the processing at the top of the loop to take care of the previous information. As you have it here, it looks like you are reading in a "MSH" for the next message, and then trying to store the previous message at the bottom of the loop.
>I'm trying to determine how to "do something" whenever the message is completed and
>before the next message starts. I've always had trouble figuring out how to get X to
>be Y, but only after the first time, or something to that effect. In the code below,
>it is only running the STORE after MSH displays, but only from the second occurrence
>on. I'm trying to get it to STORE after each message has been displayed. Thanks!
>
Steve Gibson