A priming read/chain or whatever, and a DOxxx loop controling the entry and continuation of the loop, is by far the most efficient method of coding such a thing when you consider what and how many instructions the CPU has to process to complete a given read/qualify/process loop.
As for clarity...We're dealing with "coder" preferences. It may be somewhat "old hat" thinking with regards to efficiency, but that's still the whole idea for "good" programmers. That is to get it done as efficiently computer-instruction-wise as possible. Clarity won't matter as much as efficiency when your loop may have to process milllions of records. Translate: millions of records equals millions of checks for %EOF after the single-read within the DOxxx statement. And eliminating ANY extraneous or unneccessary code is what is at the core of being "good" little programmers in our collective minds.
Moral of the story...Do your best with what you know and learn from others. It won't matter how you code it because "good" programmers will change it to "The best known practices" when they find that inefficient code. And you should do so too. Clarity has a marginal appeal, but efficiency gets the job done and therefore always gets the blue ribbon. Of course
Leave a comment: