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


  • Subject: Re: Multi Dimensional Array
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 11 Aug 1999 10:09:27 -0500

Hmmm... in which version of RPG?

In RPG IV, the %subst() BIF allows you to access/change the areas
within a character variable without the need for a second dimension
on your array.

c                   eval      A = %subst(Array(X): Y: 1)
   or
c                   eval      %subst(Array(X): Y: 1) = A


Otherwise, simulating a two dimensional array isnt very difficult,
either.  In your example, you wanted an two dimentional character
array, 100 x 60.  So you can code it like this (and the same concept
should also work in RPG III)

D Array           S              1A   DIM(6000)

c                   eval      Array(((X-1)*60) + Y) = A
   or
c                   eval      A = Array(((X-1)*60) + Y) = A


(or, if you're still using RPG III)

E                    ARR      6000  1
 *
C           X         SUB  1         I
C                     MULT 60        I
C                     ADD  Y         I
C                     MOVE A         ARR,I
C                     MOVE ARR,I     A

Make sense?


"Rajeev Asthana" <Rajeev_Asthana@paramount.com> wrote:
>
> Hi All,
>
> Is there any way to process multi-dimensional array in RPG?
> For example, there is a complile time array with 100 records and eac
>  record
> with 60 chars.
> If I want to change 35th- 50th positions of the 10th records, how ca
>  I do it?
>
> Any help is appreciated.
>
> Thanks in advance.
>
> Rajeev.
>
+---
| 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
+---END



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.