|
Dan, The key is LIKEDS and OPTIONS(*VARSIZE). h dftactgrp(*NO) actgrp(*NEW) d FLa ds Based( TEMPLATE ) qualified d dim(32766) d Fld1 10 Overlay( FLa : *Next ) d Fld2 10 Overlay( FLa : *Next ) d Fld3 3i 0 Overlay( FLa : *Next ) d myDS ds likeds(FLa) based(myDS@) d count s 10u 0 d ProcInSrvPgm pr d nbrEntries 10u 0 d dynArray likeds(FLa) options(*varsize) /free myds@ = %alloc(10*%size(myDS)); count = 10; myDS.Fld1 = 'Hello'; myDS.Fld2 = 'Goodbye'; myDS.Fld3 = 100; ProcInSrvPgm(count : myDS); *INLR = *ON; return; /end-free Note: Compiles to v5r2 but obviously fails during binding step, so not tested. HTH, Charles Wilt -- iSeries Systems Administrator / Developer Mitsubishi Electric Automotive America ph: 513-573-4343 fax: 513-398-1121 > -----Original Message----- > From: rpg400-l-bounces@xxxxxxxxxxxx > [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dan > Sent: Monday, January 30, 2006 7:46 PM > To: RPG400-L@xxxxxxxxxxxx > Subject: Passing a pointer-based array as a parameter > > I searched, but it's all greek to me. I'm not even sure I've got the > terminology correct, so feel free to correct where needed. > And, by all > means, provide links as appropriate. > > I've got an ILE RPG program (PGMA) that will call an ILE RPG > service program > (SRVPGMB). I would like SRVPGMB to return a dynamically > allocated array > back to PGMA. In real life, the array could end up having 10 > elements or > 20000 elements. > > Unfortunately, the compiler doesn't think much of passing a > dynamically > allocated array as a parameter, issuing RNF5029 "Result-Field > entry of PARM > operation in *ENTRY PLIST is not valid; specification is > ignored." I tried > to pass FLa, defined below: > > d FL@ s * > d ds Based( FL@ ) > d FLa Dim( 32766 ) > d Fld1 10 Overlay( FLa : *Next ) > d Fld2 10 Overlay( FLa : *Next ) > d Fld3 3i 0 Overlay( FLa : *Next ) > > Is there a way to accomplish this? > > TIA, > Dan > -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) > mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > >
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.