× 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.



Hi Dave,

I feel your pain.

A number of programming languages suggest that for constants to use all upper case (and from what I've seen, have words separated by underscores).
gCUSTOMER_TYPE_TEACHER looks like a great constant name to me. At my shop we don't do anything to identify a constant as local or global.

Sometimes you need to find a level of compromise with people who don't want to change. Sometimes it takes little steps for people to change.
For instance, instead of:
gCSTTY_TEA
You could ask try and see if the following would be acceptable:
gCSTTY_TEACHER

One thing I'll note, is that you don't need the CONST() in the definition of a constant.

For example, instead of this:
D gA C CONST('A')
You could code it as:
D gA C 'A'

-Kurt Anderson

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Dave
Sent: Tuesday, April 24, 2012 7:43 AM
To: Midrange Systems Technical Discussion
Subject: standards for coding constants

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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.