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




How about something like this:

     D                 DS
     Dunitsds                  1    120  3
     D                                                   dim(12)
     D units1                 1     10  3 INZ
     D units2                11     20  3 INZ
     D units3                21     30  3 INZ
     D units4                31     40  3 INZ
     D units5                41     50  3 INZ
     D units6                51     60  3 INZ
     D units7                61     70  3 INZ
     D units8                71     80  3 INZ
     D units9                81     90  3 INZ
     D units10             91    100  3 INZ
     D units11           101    110  3 INZ
     D units12           111    120  3 INZ

     C                            EVAL        unitsds(month) = something


units1...units12 are fields defined in a physical file.

Hope this helps

Mark

Mark Walter
Sr. Programmer/Analyst
Hanover Wire Cloth a div of CCX, Inc.
mwalter@hanoverwire.com
http://www.hanoverwire.com
717.637.3795 Ext.3040


                                                                                
                                     
                    Jim Langston                                                
                                     
                    <jimlangston@conexfr        To:     RPG400-L@midrange.com   
                                     
                    eight.com>                  cc:                             
                                     
                    Sent by:                    Subject:     Re: Array as a 
field name?                              
                    owner-rpg400-l@midra                                        
                                     
                    nge.com                                                     
                                     
                                                                                
                                     
                                                                                
                                     
                    05/14/01 08:10 PM                                           
                                     
                    Please respond to                                           
                                     
                    RPG400-L                                                    
                                     
                                                                                
                                     
                                                                                
                                     




Question:

It would seem to me that he could use either Overlay or a basing pointer
to do the exact same thing, correct?

Which is the more "correct" way to do it?  I would be apt to use a basing
pointer to an array and point it to MONTH01, but does Overlay have some
advantage, even if it is easier to maintain.

Regards,

Jim Langston

Me transmitte sursum, Caledoni!

John Taylor wrote:
>
> Frank,
>
> You can try this:
>
>       * Redefine the field names from your file as a data structure
>      D MonthsDS        DS
>      D  MONTH01
>      D  MONTH02
>      D  MONTH03
>      D  MONTH04
>      D  MONTH05
>      D  MONTH06
>      D  MONTH07
>      D  MONTH08
>      D  MONTH09
>      D  MONTH10
>      D  MONTH11
>      D  MONTH12
>       *
>       * Then define an array that overlays the data structure
>      D  MthsAry                            Like(MONTH01) Dim(12)
>      D                                     Overlay( MonthsDS )
>       *
>       *
>       * Now you can access each field as an array element, or by name
>      C                   Eval      MONTH01    = 1
>      C                   Eval      MthsAry(1) = 1
>
> John Taylor
> Canada
>
> ----- Original Message -----
> From: "Frank Kany" <frank.kany@hanoverfoods.com>
> To: "RPG Mailing List (E-mail)" <RPG400-L@midrange.com>
> Sent: Monday, May 14, 2001 15:07
> Subject: Array as a field name?
>
> > I have a file that has a field for each month of the year(each field
holds
> > the amount of pallets used that month).
> >
> > FILE:  MONTHTOTAL
> >
> >       A          R RECORD                   PFILE(FLDREF)
> >       A             CUSNO
> >       A             MONTH01
> >       A             MONTH02
> >       A             MONTH03
> >       A             MONTH04
> >       A             MONTH05
> >       A             MONTH06
> >       A             MONTH07
> >       A             MONTH08
> >       A             MONTH09
> >       A             MONTH10
> >       A             MONTH11
> >       A             MONTH12
> >       A         K  CUSNO
> >
> > When pallets get added or subtracted from the warehouse I want to
update
> > this file.  Since this is May(MONTH05), I would like to update only
field
> > 'MONTH05' with the correct data.
> >
> > Is there a way to use an array as a field name?
> > example:
> >  *
> >  * Array Index
> > D X               S              2P 0
> >   *
> >   * Save Current Month into a work field
> >  C                   MOVEL     UDATE         X              2 0
> >  *
> >  * Update HBI Customer Master Extension File
> > C     CUSNO         SETLL     MONTHTOT
> > C     CUSNO         CHAIN     MONTHTOT                           90
> >  *
> >  * Record Found; Update File Field
> > C     *IN90         IFEQ      *OFF
> > C                     EVAL              MONTH(X)  = CURTOTAL
> > C                     ENDIF
> >
> > Thank you,
> >
> > Frank Kany
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---




+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.