Just to beat a dead horse to death - you might be interested in overlaying
arrays.  Sample below:
     D                 ds
     D MyArray                        4a   dim(20)
     D  Code1                         2a   overlay(MyArray)
     D  Code2                         2a   overlay(MyArray:*next)

     D X               s             10i 0

      /free
       Code1(1)='AA';
       Code1(2)='BB';
       Code1(3)='CC';
       Code2(1)='ZZ';
       Code2(2)='YY';
       Code2(3)='XX';
       // At this time MyArray(1)='AAZZ', (2)='BBYY', (3)='CCXX'
       for x=4 to %elem(MyArray);
        Code1(x)=*hival;
        Code2(x)=*hival;
       EndFor;
       sorta code2;
       // At this time MyArray(1)='CCXX', (2)='BBYY', (3)='AAZZ'
       sorta code1;
       // At this time MyArray(1)='AAZZ', (2)='BBYY', (3)='CCXX'
       *inlr=*on;
       return;
      /End-free

This allows you to sort an array by a substring.  I think it is pretty
cool.  It is also great for related arrays - which sounds like what you are
doing.

Rob Berendt

==================
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin



                    Richard Reeve
                    <richreeve@yahoo.co       To:     midrange-l@midrange.com
                    m>                        cc:
                    Sent by:                  Fax to:
                    midrange-l-admin@mi       Subject:     RE: array handling
                    drange.com


                    12/01/2001 10:30 AM
                    Please respond to
                    midrange-l






It is RPGIV.  Just to clarify a bit, I am reading a
file (doing a reade) that contains MHS hold codes and
the corresponding legacy hold code.  I am then wanting
to load the array and later in the program I want to
do a lookup on the MHS hold code to find the
corresponding legacy hold code.

--- jt <jt@ee.net> wrote:
> Reeve,
>
> What flavor of RPG?  RPGIII = RPG400, or ILE RPG?
>
> If ILE, you can use standard C-specs, CX-specs (with
> %lookup built-in
> function).  If on V5R1, and you wanna use free-form,
> somebody else will have
> to help.
>
> jt
>
> | -----Original Message-----
> | From: midrange-l-admin@midrange.com
> | [mailto:midrange-l-admin@midrange.com]On Behalf Of
> Richard Reeve
> | Sent: Saturday, December 01, 2001 9:20 AM
> | To: midrange-l@midrange.com
> | Subject: array handling
> |
> |
> | All,
> |
> |      I am having a problem with an array in RPG
> | (caused mainly by my ignorance where RPG is
> concerned
> | since I am a COBOL kind of guy!).  What I am
> trying to
> | do is to read a file and load an array that will
> have
> | 2 elements - a legacy hold code (2 positions) and
> a
> | MHS hold code (2 positions).  I then want to do a
> | lookup on this array by MHS hold code and find the
> | corresponding legacy hold code (later in the
> program).
> |
> |      Could someone be kind enough to coach me
> through
> | this?  I will be forever greatful.
> |
> | Rich
> |
> | =====
> |
> |
> | __________________________________________________
> | Do You Yahoo!?
> | Buy the perfect holiday gifts at Yahoo! Shopping.
> | http://shopping.yahoo.com
> | _______________________________________________
> | This is the Midrange Systems Technical Discussion
> (MIDRANGE-L)
> | mailing list
> | To post a message email: MIDRANGE-L@midrange.com
> | To subscribe, unsubscribe, or change list options,
> | visit:
>
http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> | or email: MIDRANGE-L-request@midrange.com
> | Before posting, please take a moment to review the
> archives
> | at http://archive.midrange.com/midrange-l.
> |
>
> _______________________________________________
> This is the Midrange Systems Technical Discussion
> (MIDRANGE-L) mailing list
> To post a message email: MIDRANGE-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit:
>
http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> or email: MIDRANGE-L-request@midrange.com
> Before posting, please take a moment to review the
> archives
> at http://archive.midrange.com/midrange-l.
>


=====


__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com
_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.







As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.