Peter Colpaert wrote on 03/05/2007 09:08:06:
Kent,
I like the fact that you can give the litterals a more descriptive name.
We have an application where we have attributes, keyed by number.
To use them in our RPG programs, we pull in a /copy member with the
constants:
d ....
d attr_concept c 108
d attr_color1 c 109
d attr_color2 c 110
d attr_color3 c 111
d attr_color4 c 112
d attr_freetext c 113
d attr_gadgets c 114
d attr_stackID c 115
d attr_inserttype...
d c 116
d attr_handle c 117
d attr_size c 118
d attr_bulbtype c 119
d attr_dimension1...
d c 120
d attr_dimension2...
d c 121
d attr_dimension3...
d c 122
d ....
I find "attr_dimension1" easier to remember than "120".
Could be my age showing, though ;-)
I agree ... so it's probably not (just) an age thing :) Some people would
also suggest that instead of something like
minutes = hours * 60;
you should write something like
D MINUTES_PER_HOUR...
D C 60
minutes = hours * MINUTES_PER_HOUR
This is probably verging on an "ivory tower" approach, but if you start to
do conversions like litres to gallons, kilometres to miles, kiloPascals to
atmospheres, etc., the argument starts to make a lot of sense. Of course,
these kinds of functions are best to have in a *SRVPGM, but we all know
that doesn't always happen for various reasons. One way I use this
strategy is to help myself when reading my own code later on. Instead of
" %trimR(vuCat) = 'T'; " I'd probably use something like " %trimR(vuCat)
= UNIT_TYPE_TRAILER; ". That way, I don't need to remember that vuCat is
vehicle category, or that 'T' mean trailer, not tractor.
HTH,
Adam
Attention:
The information contained in this message and or attachments is
intended only for the person or entity to which it is addressed and may contain
confidential and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon, this
information by persons or entities other than the intended recipient is
prohibited. If you received this message in error, please contact the sender
and
delete the material from any system and destroy any copies. Thank you for your
time and consideration.
Attention:
Le contenu de ce message et(ou) les fichiers ci-joints s?adressent
exclusivement à la personne ou -entité à laquelle ils sont destinés. Ils
peuvent
contenir de l?information confidentielle, protégée et(ou) classifiée. Il est
strictement interdit à toute personne ou entité autre que le(la) destinataire
prévu(e) de ce message d?examiner, de réviser, de retransmettre ou de diffuser
cette information, de prendre une quelconque action en fonction ou sur la base
de celle-ci, ou d?en faire tout autre usage. Si vous avez reçu ce message par
erreur, veuillez communiquer avec l?expéditeur(trice), supprimer ce message et
les fichiers ci-inclus de tout système, et en détruire toutes copies, qu?elles
soient électroniques ou imprimées. Nous vous remercions de votre entière
collaboration.
As an Amazon Associate we earn from qualifying purchases.