|
Here's how I like to code it. DoW 1 = 1 Read If %eof Leave End if // Do something Enddo The reason being is when the manager then comes to you and says the program you wrote is great but we need to skip all records with a X in them you can easily change it to: DoW 1 = 1 Read If %eof Leave End if If record = 'X' Iter Endif // Do something Enddo Then you don't have condition your read with an IF. Just my 2 cents worth. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Morgan Sent: Tuesday, February 01, 2005 2:27 PM To: rpg400-l@xxxxxxxxxxxx Subject: RPG read loops Almost all of the code in the current Leave / Iter thread showed a loop like: DoU F3 or F12 exfmt If Not (F3 or F12) // do something EndIf EndDo This only has one exfmt statement inside a DoU loop. A similar file read loop would be: DoU %EoF Read If Not %Eof // do something EndIf EndDo which has one read statement inside of a DoU loop. Isn't there a better way of coding loops with more than one read/exfmt like: exfmt DoW Not (F3 or F12) // do something exfmt EndDo or Read DoW Not %Eof // do something Read EndDo or SetLL ReadE DoW Not %Eof // do something ReadE EndDo
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.