|
May I throw in my two cents on this? The LEAVE is totally unnecessary if the section labeled "other code" is a group of CASEQ checking the WORKSTN feedback or assigned indicators. You could check the AID byte, feedback status code or whatever. I've rarely written a program where some form of cleanup wasn't required when the user pressed F3 (like turning on LR .. where F12 RETRN without LR) The previously exampled construct only allows for a single (F3) exit where we all know that the real world requires multiple points. Sure, you could have a bunch of OREQ statements, but, again, for a template program I've found it better to give an explicit point for action to occur. How about: C $loop DOWEQ Yes C EXFMT SCREEN C *IN03 CASEQ*ON $cf03 C *IN12 CASEQ*ON $cf12 C STATUS CASEQ1130 $TIMEOUT C STATUS CASEQ0000 $ENTER C ETC C ENDDO Joel Fritz wrote: > It's a mattter of style or aesthetics. The code works fine, but the loop > control statement doesn't do anything. My aesthetic theory of programming > sez: "A loop control statement should be the only exit point." <<snip>> > > > > > Simple, almost elegant. > > Bob > > Joel Fritz wrote: > > > > > In the same vein: > > > > > > C *IN03 DOWEQ*OFF > > > C EXFMTSCREEN > > > C *IN03 IFEQ *ON > > > C LEAVE > > > C ENDIF > > > C* OTHER CODE > > > C ENDDO > > > > > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---END
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.