× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



One of the reasons I remember being told to do this is what if they change
account types. The business expanded or some VP has a "wonderful new
system". Account 32 is now Account 132. In each program you only need to
update one place and recompile.





Alan Shore <AlanShore@xxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
05/03/2007 09:58 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Re: Benefits of declaring literals in D-specs






Brian - I agree with your thought process, but over time, I have found
there is one problem with this idea.
To you, Acct_type 32 is defined as DEAD-BEAT, but to someone else
Acct_type
32 is defined as DEFUNCT_TYPE, therefore a search on DEFUNCT will result
in
nothing found, and therefore a search of 32 is then required.
By itself - no great shakes, but somewhat irksome.



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx
"If you're going through Hell, keep going" - Winston Churchill

rpg400-l-bounces@xxxxxxxxxxxx wrote on 05/03/2007 10:30:28 AM:

Named literals avoid the magic number anti-pattern. What does these
statements mean:

if status_code = 32
return
endif

if acct_type = 32
...
endif

What the heck is 32? Are both 32's the same thing?

Compare to this

d EXIT_KEY_PRESSED C 32
d DEAD_BEAT C 32
...

if status_code = EXIT_KEY_PRESSED
return
endif


if acct_type = DEAD_BEAT
...
endif

Now the code is much clearer. And, if you want to locate code that
processes dead-beat accounts, it is ead to find. If you search for 32,
you
have to examine each reference and decide if it is account type or some
function key thing.






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.