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



Hello Richard,

I think you have found a bug in the compiler.  I created a test program
using your supplied code and used EVAL %ADDR() to check the addresses of
the fields in the underlying data structure and the addresses of the
fields in the overlay and you are correct in your assertion that only the
first field is correctly overlayed.

I believe this is a bug because the following clumsy work-around causes
the overlays to be built correctly.

DDSINPUT        E DS                  EXTNAME(DSUPDPAG)

D DSDATA                       159                  overlay(DSINPUT)
D $fill1                              like(QZSESS ) overlay(DSdata)
D $fill2                              like(QZBTCH ) overlay(DSdata:*next)
D $fill3                              like(QZREF  ) overlay(DSdata:*next)
D $QzAmt                              like(QZAMT1 ) overlay(DSdata:*next)
D                                      dim(12) inz(0)
D $QzChk                              like(QZCHK1 ) overlay(DSdata:*next)
D                                      dim(12)

Notice that I have inserted a field which overlays the entire DS and the
other fields overlay that.  I didn't bother to pore over the RPG
Reference but I can see no difference between overlaying the DS name and
a subfield.  You should open an APAR with IBM support to get this fixed.
(It may be Working As Designed but it sure ain't correct.)

However, I think a better approach would be something like the following:

DDSINPUT        E DS                  EXTNAME(DSUPDPAG) INZ

D @QzAmt          S               *   INZ(%addr(qzamt1))
D @QzChk          S               *   INZ(%addr(qzchk1))

D $QzAmt          S                   like(QZAMT1 ) based(@qzamt)
D                                      dim(12)
D $QzChk          S                   like(QZCHK1 ) based(@qzchk)
D                                      dim(12)

then simply ignore the pointers and just use the arrays as you would
normally.

And why can't I code:

D $QzAmt          S                   like(QZAMT1 ) based(%addr(qzamt1))
D                                      dim(12)

and let the compiler worry about the pointer?

Regards,
Simon Coulter.

--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists
   http://www.flybynight.com.au/

   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



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.