|
Let me see if I got this straight. In my original example PdLb02 overlays an array variable and is thereby recognized as an array itself. And externally described fields can not be defined as an array. In the example below PdLb02 overlays a field and it's definition is implicitly derived from the externally described file which makes everything happy. Therefore, memory addressing didn't have didilly to do with it. Patrick Conner www.ConnecTown.com (828) 244-0822 "Joep Beckeringh" <joep@beckeringh. To: <rpg400-l@midrange.com> myweb.nl> cc: Sent by: Subject: Re: Externally-Described Field used as array name. rpg400-l-admin@mi drange.com 08/23/00 06:17 PM Please respond to rpg400-l Patrick, When you overlay an array, the result is automatically an array as well. What you can do is this: D ds DPdLb_fld DPdLb01 Overlay(PdLb_fld:*NEXT) DPdLb02 Overlay(PdLb_fld:*NEXT) DPdLb03 Overlay(PdLb_fld:*NEXT) DPdLb Like(PdLb01) Overlay(PdLb_fld) Dim(3) You create a dummy field that contains the array (I think the compiler calculates the length for you). You make the individual fields overlay the dummy field; you don't have to supply the definition if they are defined elsewhere (externally described file); by using *NEXT you don't have to worry about the positions either. Lastly you create an array that overlays the dummy field (and thus the individual fields) by not specifying *NEXT or a position (or by specifying ':1'). Joep Beckeringh ----- Original Message ----- From: <PatrickConner@parkdalemills.com> To: <rpg400-l@midrange.com> Sent: Thursday, August 23, 2001 10:06 PM Subject: Externally-Described Field used as array name. > D ds > DPdLb Like(PdLb01) Dim(3) > DPdLb01 Overlay(PdLb) > DPdLb02 Overlay(PdLb:8) > DPdLb03 Overlay(PdLb:15) > > > 932=I S 60 66 0WK1AVL > 933=I S 67 73 0PDLB02 > ======> aaaaaaaaaaaaaa > *RNF4138 30 a 000016 Externally-Described Field used as array name. > Definition > specification is ignored. > 934=I S 74 80 0WK2SHP > > > Why? > > I think I understand that it is a memory address thing, but I'd like an > clear explanation. > > Patrick Conner > www.ConnecTown.com > (828) 244-0822 _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com
As an Amazon Associate we earn from qualifying purchases.
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.