× 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: DDS arrays
  • From: dhandy@xxxxxxxxxxx (Douglas Handy)
  • Date: Tue, 02 Nov 1999 23:17:48 -0500

Jim,

>I am converting a S/36 flat file to native.  Within this file are an
>"array" of numbers.

(snip)

>I would like to be able to do something in RPGIV similar to this, 

Here is what I do:  create an array based on a pointer, then
initialize the pointer to the address of the first field (which would
also become the first array element).  This makes the array an overlay
of the subfields, and no moves are necessary.

To make this work, the fields need to be in a DS to force them to be
contigous in storage.  If the file is named as an external DS, then
that will work provided the fields are contigous in the definition.
If you don't use an external DS for the file, then code a DS and name
the subfields but *don't* define the type/size.  This makes future
maintenance easier.  Here is an example:

     D                 DS

     D D601

     D D602

     D D603

     D D604

     D D605

     D D606

     D D6Ptr           S               *   Inz(%addr(D601))

     D D6              S                   Dim(6) Based(D6Ptr)
     D                                     Like(Oqa01)

With an external DS and contiguous fields, you only need to add the
based array and initialized pointer definitions.

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

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.