|
I agree strongly, Buck. I would create the IF and END statements first, putting the right hand comment on them, and then insert the conditioned statements between them. In large programs where I had to go back in and put in other conditionals, it helped to have the comments during debug because I could look at the nesting level and the comment to check that the correct END was still being applied to my IF. Chris Rehm javadisciple@earthlink.net If you believe that the best technology wins the marketplace, you haven't been paying attention. ----- Original Message ----- From: "Buck Calabro" <Buck.Calabro@commsoft.net> To: <RPG400-L@midrange.com> Sent: Wednesday, July 25, 2001 7:15 AM Subject: Right side comments > Right side comments do have value if used judiciously. In the RPG III > world, I used to use right side comments in the C specs, but only for COMP, > IF/END, DO/END SELEC/WHEN/ENDSL etc. groups. > > C DDD IFGT RPTDAY > RPTDAY > C SUB 1 YY > C ADD 365 DDD > C END > RPTDAY > > I find that there is just too little room for a "real" comment, but much of > the RPG III code is so monolithic that there can be hundreds or even > thousands of lines between the IF and the corresponding END, so the right > side comments can help there. I believe that having a mnemonic rather than > a "how deep are we nested" number is more useful because sooner or later, > that code will get an extra IF or have one taken out, and then the comments > are out of whack with reality. Further, scanning on 0001 will turn up way > too many false hits, whereas "> RPTDAY" will only find my two places. It is > actually useful to add this sort of right side comment when going in to > legacy code for the first time. > > In the RPG IV world, when I'm visiting code like that (many lines between IF > and END) I have a very strong tendency to make the interior code a > subroutine (with a nice long descriptive name) so that I can see the > decision point and the action on the same editor screen. > > C DDD IFGT RPTDAY > C exsr decrJulianYear > C END > > C decrJulianYearbegsr > C SUB 1 YY > C ADD 365 DDD > C endsr > > Buck Calabro > Commsoft; Albany, NY +--- | 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 +---
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.