What do you mean not about RPG???
You mean there is something other than RPG???
GASP!
LOL
Norm Dennis
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dennis Lovelady
Sent: Friday, 15 January 2010 7:16 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: Double Negative was RE: rpg style question
Some of us were taught various techniques and logic to assist with the
readability and performance of the type coding that was around in RPG
II and
III.
Dennis was referring to the technique of always testing to the positive
where possible.
Thanks, Norm, that's about it. Except that when I learned this, it wasn't
about RPG II or III; wasn't even about RPG at all in fact, it was about
programming. The idea is about putting it the way the mind will be most
comfortable with it.
Please forgive the digression: Simon mentioned something about COBOL doing
one thing better than RPG (but he seemed to question his own logic ;)).
But COBOL's condition names are phenomenal answers to this type of problem.
With condition names, you can have something like:
77 weekday-number pic 9.
88 Sunday value 0.
88 weekday values 1 thru 5.
88 weekend values 0, 6.
88 odd-school-days values 1, 3, 5.
88 even-school-days values 2, 4.
With such data definitions, you can write code like
IF Sunday ...
IF odd-school-days ...
IF weekday ...
(For those who "don't get it," the above are all tests of the value of
variable "weekday-number".) Now THAT is programmer-friendly! Never a need
to code to the negative. Too bad we don't have that in RPG!
Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
There will be a rain dance Friday, weather permitting
As an Amazon Associate we earn from qualifying purchases.