× 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: Data Arrays
  • From: bmorris@xxxxxxxxxx
  • Date: Fri, 6 Oct 2000 15:30:21 -0400
  • Importance: Normal


>Date: Fri, 6 Oct 2000 12:49:18 -0400
>From: <groyle@cott.com> (Gordon S. Royle)
>
>I've been searching manuals trying to find the RPG equivalent to the
>following Cobol code.
>
>01  INDEX     BINARY.
>01  ARRAY.
>    05   ROWS OCCURS 10 TIMES.
>         10   ELEMENT1       PIC X(20).
>         10   ELEMENT2       PIC S9(5)V9(5) COMP.
>         ETC.
>
>MOVE 9 TO INDEX.
>MOVE 'Wish I could do this" TO ROWS(INDEX).


Gord, a multiple-occurrence data structure (search for OCCUR) is
one possibility, but you can only use one occurrence at a time.

Another possibility is overlay arrays.  If *next isn't supported
on your release, you'll have to code the length of "ARRAY" (250?)
and also the explicit positions of the overlays (1, 1, 21).

D               DS
D  array
D   rows                overlay(array:*next) dim(10)
D     element1    20a   overlay(rows:*next)
D     element2     9??5 overlay(rows:*next)

C         eval     index = 9
C         eval     rows(index) = 'You can do this'
  or
C         eval     element1(index) = 'something'
C         eval     element2(index) = something + else

Barbara Morris


+---
| 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-Ups:

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.