in reply to do-until inside while loop control

Give us some code we can run with a minimum of code and data required to show the issue. See I know what I mean. Why don't you? for hints.

Premature optimization is the root of all job security