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



You could do it with an array
D                                              DS
D myFields                                                       1
100         DIM(10)
D  field1                                                              1
10
D ....
D field10                                                           91
100

Dindex                                     S
10i 0


 /free
     for index = 1 to 10;
          chain myFields(index) MyFile;
          *in(index) = not %found(MyFile); //error exists
     end-for
  /end-free


Thanks,

Mark

Mark D. Walter
Senior Programmer/Analyst
CCX, Inc.
mwalter@xxxxxxxxxx
http://www.ccxinc.com


                                                                           
             Pete Helgren                                                  
             <Pete@xxxxxxxxxx>                                             
             Sent by:                                                   To 
             rpg400-l-bounces@         RPG Midrange Discussion             
             midrange.com              <rpg400-l@xxxxxxxxxxxx>             
                                                                        cc 
                                                                           
             06/30/2005 01:46                                      Subject 
             PM                        Multiple sequentially numbered      
                                       fields and indicators in /FREE      
                                                                           
             Please respond to                                             
              RPG programming                                              
              on the AS400 /                                               
                  iSeries                                                  
             <rpg400-l@midrang                                             
                  e.com>                                                   
                                                                           
                                                                           




When I moved to RPG IV I started out by using /FREE (which I like very
much).  But I am struggling with moving some of the RPGIII concepts to
/FREE.

I have a prompt screen that has 10 selection values (Field0 through
Field9) and I call a subroutine that validates these fields before
submitting. So I have to step through each field, chain to a file to
validate the value and then set on an indicator.  My problem is getting
my head around the concept.  In RPG III I would have written something
like:


FIELD1    CHAIN   MYFILEFMT       97
*IN99       IFEQ      *ON
                  SETON                               20  (Reverse Image
and Highlight)
                  ENDIF
FIELD2     CHAIN  MYFILEFMT       97
*IN99       IFEQ      *ON
                  SETON                               21  (Reverse Image
and Highlight)
                  ENDIF

And so on.....but I think I should be able to construct a DO loop to
iterate through the fields.

So, first how would I reference the fields for the chain in FREE?  I
*don't think* I can do:

Count = 0;
DOW count <10;
FieldName = 'Field' + %char(count);
             chain  FieldName  MyFile;
             if  not%found(MyFile);
             //seton the indicator
.........etc
Count = Count + 1;
ENDDO;

Can't do it because I think the chain will occur with the literal value
'Field0'.....

Second, with the indicator value I'd like to do something like
incrementally setting on the correct indicator starting at a particular
starting value plus the counter.  Something like:

*in,(20 + count) = *on;   although I know referencing indicator arrays
in this way can't be done in /free.

Using arrays for all of this comes to mind as well.

Is there a simple solution to this ?  ( I have ordered a couple of books
about /free but they won't arrive until after August 5th  :-(

Thanks,

Pete Helgren


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