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



Scott,
 
I may not have made myself clear about why I have the indicator 'on' for an
invalid condition. 
For example, I have mapped 'Prt#Invld' to *In23. If an invalid condition
occurs for the part#, I want the cursor to be positioned at that field on
the screen, and have the field be reverse-imaged. In my screen DDS I have
the display attributes 'RI' and 'PC' conditioned by *In23. If the indicator
field was 'Prt#Valid, I would need to change the DDS indicator to 'N23' and
set 'on' all the cursor position/reverse indicators for all fields above the
part#. My convention is to set OFF all '*In' indicators every time a screen
is read. I use the '*In' indicators ONLY for setting screen attributes. 

I also don't like the idea of 'having to keep' the pairs of indicators in
sync.
That's why I was trying to see if there was a method to AUTOMATICALLY
synchronize the pair of variables.

As far as having 'valid' or 'invalid' in the name, it makes sense to me.
They are variables, and their values DO change.
When the part is valid: 
        Prt#Valid = *On (or would be if this field existed)
        Prt#Invld = *Off 
When the part is invalid:
        Prt#Valid = *Off
        Prt#Invld = *On (mapped to *In23 for cursor positioning/reverse
imaging)
So rather than code:
If PrtStatus = InValid;
I code (and find as readable):
If Prt#Invld;

What I was hoping to avoid was:
If (Not Prt#Invld); (the double negative I was hoping to avoid)
By replacing it wit:
If Prt#Valid;
But ONLY if I could set the pair of variables SIMULTANEOUSLY and
AUTOMATICALLY.

Sorry for any confusion.

Tim Kredlo
Exterior Wood, Inc


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Scott Klement
Sent: Wednesday, September 08, 2004 8:55 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Indicators


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.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-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.