On 9/3/2010 3:59 AM, David FOXWELL wrote:
Working on a RPGIII that has just been converted to IV.
Need to test a field to see if its value is 'X0'.
So why not do this?
    IF Field = 'X0';
      //whatever
    endif;
Or in the older RPGIII-like syntax:
    C     FIELD1        IFEQ      'X0'
I guess I don't understand why you'd use a constant like cX0.  It 
provides no clarity to the code -- in fact, it just makes the code 
harder to read, because now you have to see what value cX0 contains... 
whereas if you compare to the literal 'X0', it's obvious.
You should only use constants where the name of the constant CLARIFIES 
it's meaning.
For example, you could change this:
   If Field1 < 5;
To this:
   If Field1 < MINIMUM_PRICE;
(or in RPGIII like syntax):
   C     FIELD1        IFLT      MINPRC
You now know what the 5 meant...  whereas before, you either had to 
guess, or look for comments/documentation that explained it.  Naming the 
constant something like c5 wouldn't have clarified anything, and 
therefore would've been a waste of your time & the "next guy's" time.
The name of a variable/constant should never be a simple echo of it's 
value.  That's pointless.
As an Amazon Associate we earn from qualifying purchases.
	
 
This mailing list archive is Copyright 1997-2025 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.