× 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 Tim,

> As such, if I want to do something when a condition IS VALID, I end having
> to use a double-negative, such as "Not Prt#Invld".
> For readability I would much rather use "Prt#Valid", but my output screen
> indicators would then have to be a series of 'N##'s.

One simple solution is to simply avoid the use of "negatives" in your
variable names.  In other words, never have an "invalid" variable, only a
"valid" variable.  For example:

     if ( Not Part#Valid );
         // do whatever you planned to do
     endif;

Another way to deal with it is to take the "valid" or "invalid" out of the
name altogether.  Remember, the purpose of variables is to store something
that can be changed...  the part of this particular variable that can be
changed is whether or not the part number is valid. :)   So, either
putting "valid" or "invalid" in the name doesn't make sense, that's the
part that changes.

Instead, make names for the VALUES of the variable, and use a more generic
name for the variable itself.  For example:

     D INVALID         c                   '0'
     D VALID           c                   '1'

     D Part#Status     s              1N   inz(VALID)

      /free

           chain (Part#) PARTMASTER;
           if %found();
              Part#Status = VALID;
           else;
              Part#Status = INVALID;
           endif;

      ... and later ...

           if ( Part#Status = INVALID );
           endif;

        ... or ...

           if ( Part#Status = VALID );
           endif;

      /end-free

Personally, I don't like your idea of having separate "Part#Valid" and
"Part#Invalid" variables and then having to figure out how to keep them in
sync all the time.  I don't think that's as intuitive.

That's just my opinion, of course.

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.