× 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 Structure redefinition
  • From: "M. Lazarus" <mlazarus@xxxxxxxx>
  • Date: Sat, 04 Nov 2000 22:30:13 -0500

Peter,

At 11/2/00 09:15 AM -0800, you wrote:
>In my example, the only thing that has to match is the total lengths of the
>data structures. The pointer makes the 2nd data structure point to the same
>area as the 1st. To make it a little clearer, how about:
>
>D DS1    DS
>D  A          3a
>D  B          5s 0
>D  C         11p 2
>D            12    inz(*blanks)
>
>Note that the total length of DS1 is 26 bytes.
>
>D DS2    DS        based(ptrDS1)
>D  D         15p 5
>D  E         18a
>
>Note that the total length of DS2 is also 26 bytes.
>
>D ptrDS1 S     *   inz(%addr(DS1))
>
>Now both DS1 and DS2 occupy the same memory positions. Is that what you're 
>after?

  Interesting example, although I find it a little difficult to find a good 
use for it, since the OVERLAY keyword within the same DS would accomplish 
the same thing and would be be a lot clearer to the next guy.

  It looks like I'm not going to be able to do what I was looking to do 
using the pointer shortcut.  My requirement was something like the 
equivalent of this (pseudocode):

D SomeDS         DS
D  A
D  B
D  C
D  D

D NextDS         DS
D                     15        INZ( 'First Heading:' )
D  A
D                     17        INZ( 'Second Heading:' )
D  B
D  C
D  D

D ThirdDS        DS
D  A
D                     17        INZ( 'RPG IV is Cool:' )
D  B
D  C
D  D
D                     10        INZ( 'Trailer' )

D LastDS         DS
D  B
D  A
D                     10        INZ( 'Filler' )
D  D
D  C

...etc.

  Notice that the subfield sequence and total DS lengths can be different.

  Since DS's don't allow having the same field name in more than one, I 
wanted to accomplish this using pointers, but RPG won't allow it.  The 
simple solution (albeit much longer than the pointer solution would have 
been) is to make the field names unique (except the first DS) and just use 
EVALs.  Oh well.

  -mark

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