Yep, he just codes 'em how he's told to. You can probably guess why short
constants are preferred when you see the old 6 character variable names
dating from when 6 was all that was allowed in the data dictionary.

Long constants are so tedious in SEU !


One point that has been raised is the more often necessity to find and open
the copy book - the constant definition is no longer in the code you're
using. Also, imagine for some reason the value of the constant changes. eg,

D gGSTTY_TEACHER C 'PRF'

(professeur = French for teacher :-) )






Le 24 avril 2012 15:11, Charles Wilt <charles.wilt@xxxxxxxxx> a écrit :

I often find it necessary, especially in existing systems, to pre-fix
my constants with the field/variable ...

So I could understand
CSTTYP_TEACHER

Though I'd agree that
CUSTOMER_TYPE_TEACHER

is usually better...

As an argument for your preferred name, point out that that there's no
additional information in
IF wCstTy = gCSTTY_TEA

than there was in
IF wCstTy = ‘TEA’ ;

In both cases you need to know that TEA = TEACHER..

In contrast,
IF wCstTy = gCUSTOMER_TYPE_TEACHER ;

tells you a lot...

Does the guy writing the copybook know how to create long constants?

My motto...the bigger the scope, the longer the name.

Charles



On Tue, Apr 24, 2012 at 8:59 AM, Roberto José Etcheverry Romero
<yggdrasil.raiker@xxxxxxxxx> wrote:
I believe it's the later. if the variable was already name wCstTy what
good does naming the constant CSTTY?
It's the same unreadable code.
The whole point of using constants is writing long explanations. For
example when you make a mask in bitwise operations...
byte = EnableDST + NoPPW + EnableUltraMode + NoSystemShutdown etc etc
etc. Meaning you can read without referencing the copybook.
The copybook should only be needed to WRITE the constant, not to read it.

Best Regards,


On Tue, Apr 24, 2012 at 9:54 AM, Jeff Crosby <jlcrosby@xxxxxxxxxxxxxxxx>
wrote:
I'm not sure I understand what you're complaining about.

You asked for a copybook of constants, you got it, and now you're
complaining because you have to use it? Or are you complaining because
the
constant was named " gCSTTY_TEA" instead of " gCUSTOMER_TYPE_TEACHER?"



On Tue, Apr 24, 2012 at 8:43 AM, Dave <dfx1@xxxxxxxxxxxxxx> wrote:

Here’s an example of our shop’s RPG code :



IF wCstTy = ‘TEA’ ;



Means if the customer type indicates a teacher. Cst for customer, Ty
for
type, w for local variable.



I would write this way, using a globally defined constant :



IF wCstTy = gCUSTOMER_TYPE_TEACHER ;



I proposed that we create a copybook for such constants so that
everyone
would use the same names and to avoid seeing this kind of thing :



D gA C CONST(‘A’)



My wish was granted, and a copybook has been created. But now, I can’t
use
the constant in my example above. I now have to write :



IF wCstTy = gCSTTY_TEA ;



I feel like I’m bashing my head against a brick wall.



Any comments to make me see the error of my ways would be more than
welcome.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




--
Jeff Crosby
VP Information Systems
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
www.dilgardfoods.com

The opinions expressed are my own and not necessarily the opinion of my
company. Unless I say so.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




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-2019 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].