|
Michael, Free vs. fixed is another one of those possible religious war things but just a quick example: Here's the fixed format indicator less code from your original post: * Test passed date & set error flag if bad C Select C When (PRMFMT = '*YYMD') C *ISO TEST (DE) PRMSDT C If NOT %Error C *ISO TEST (DE) PRMEDT C Endif C When (PRMFMT = '*MDYY') C *USA TEST (DE) PRMSDT C If NOT %Error C *USA TEST (DE) PRMEDT C Endif C EndSL C If %Error C Eval PRMERR = *ON C Endif Here's a free format version: /free select; when PRMFMT = '*YYMD'; test (DE) *ISO PRMSDT; if not %error; test (DE) *ISO PRMEDT; endif; when PRMFMT = '*MDYY'); test (DE) *USA PRMSDT; if not %error; test (DE) *USA PRMEDT; endif; endsl; if %error; PRMERR = *ON; endif; /end-free Granted, your familiarity with the original code means you read it just fine. But, imagine that it's been months since you wrote it...which is easier to read? It's much more obvious at a glance how "deep" the test of PRMEDT is in the free format version. If you still have doubts, pick out a couple of fixed format RPG programs you haven't looked at in a while. Particularly if the programs are ones you dread having to modify. Next download the RPG Toolbox from Linoma Software: http://www.linomasoftware.com/products/rpgtoolbox/conversion.html Use one of the 10 (?) free trial conversions to see what you really think of free format. Charles > -----Original Message----- > From: Michael Naughton [mailto:michael_naughton@xxxxxxxxxxxx] > Sent: Thursday, August 19, 2004 9:24 AM > To: RPG programming on the AS400 / iSeries > Subject: Re: Indicators > > > Hi Bob, > > Knowing you both by reputation and from this list, I have > enormous respect > for you, your expertise, and your opinions. It is with all > that respect > that I humbly suggest that "readability" is in the eye of the > beholder. If > you find /free more readable, then I won't argue with you. > Personally, I > don't, although I hasten to add that a) I don't find it > "less" readable, > either, and b) I'm very open to the possibility that I may change my > opinion in the future. > > The question of readability has come up before, and I don't > want to open > another can of worms. But I am firmly convinced that, in programming > languages, readability has more to do with what someone is used to and > whether the logic and program flows are clean and consistent > than in how > many indents you can use. At my current job, my boss has developed a > consistent structure for his programs, and once I learned > what it was I > found (and still find) it very readable (and he loves left-hand > indicators). Can someone write cryptic, confusing code using left-hand > indicators? -- sure they can, and Ron posted a great example. > But I have > seen code written in "free" formats that was convoluted and > confused, and > the mere fact that it was free-form didn't help anything. > > In the example I posted, I took a code sample that I thought > was perfectly > clear and readable and asked, "doesn't trying to eliminate > the indicators > make this worse?" You, Charles, and others have shown me that > the answer > is, "not necessarily". That was good, I learned something, > thank you all. > > But I didn't find the examples "more" readable; instead simply "as" > readable, and that's why I don't feel any incentive to put > time and effort > into switching over. Like many shops, we have a huge amound > of installed > code that was written in the old way. I _do_ see great benefits in > switching to RPGIV -- in fact, I convert just about every OPM > program I > work on. I love "Eval" and the string handling functions, and > I think in > general the language offers huge improvements in functionality. If all > that moving on to /free will give me is "readability", > though, then right > now, for me, I don't see the benefit. But time will tell . . . . > > Respectfully, > > RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> writes: > >You are missing readability, which is also the number one offering of > >/free, but is that underwhlems you then I'm not sure what to say. I'm > >not trying to dig at you or suggest that you need to switch to /free, > >just that if you don't at least acknowledge the readability of things > >like /free and the PITA factor of things like left-hand > indicators, then > >we are at an impasse. > > > Mike Naughton > Senior Programmer/Analyst > Judd Wire, Inc. > 124 Turnpike Road > Turners Falls, MA 01376 > 413-863-4357 x444 > mnaughton@xxxxxxxxxxxx > > -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) > mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. >
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.