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



Ooooh!  I guessed right!  How do you define it as static?  How would you
pass a memory allocation, or do you mean pass the sales array as a variable
with VALUE option?

Joel R. Cochran
Director of Internet Services
VamaNet.com
(800)480-8810
mailto:webmaster@vamanet.com


> -----Original Message-----
> From: Scott Klement [mailto:klemscot@klements.com]
> Sent: Friday, April 26, 2002 4:58 PM
> To: rpg400-l@midrange.com
> Subject: Re: Same procedure different problem
>
>
>
> Mark,
>
>     "p_plan" contains the address of the variable called "plan", and
> "plan" is local to your subprocedure.
>
> When the subprocedure ends, "plan" is destroyed, so the
> address of "plan"
> isn't very useful to the main procedure. :)
>
> The fix is to either allocate the space for "plan" in your
> main procedure,
> and pass it in as a parameter, or define it as static in your
> subprocedure.
>
> Good luck!
>
>
>
> On Fri, 26 Apr 2002 MWalter@hanoverwire.com wrote:
>
> > Arrrrggghhh,
> >
> > The procedure which I used  a work around for the previous
> problem is now
> > giving me fits!!!. Here is the code AGAIN:
> >
> > /* significant code from the Main procedure */
> >      dgetPlanedSales   PR              *
> >      D                               15a   CONST
> >      D                                4p 0 CONST
> >      D                                3p 0 CONST
> >
> >      DitemIsSku        PR              N
> >      D item                          15a   CONST
> >
> >      Dsales            s             11p 3 DIM(12) based(p_sales)
> >      dp_sales          S               *   INZ
> >
> >      c                   eval      p_sales =
> >      c
> getPlanedSales(itnbr:fiscalYr:seq#)
> >
> > /* Subprocedure */
> >
> >      H NoMain
> >      fSls600wfl if   e           k Disk    usropn
> >
> >      d                 DS
> >      DdsPlan                   1    120  3 DIM(12)
> >      D fcstum1                 1     10  3 INZ
> >      D fcstum2                11     20  3 INZ
> >      D fcstum3                21     30  3 INZ
> >      D fcstum4                31     40  3 INZ
> >      D fcstum5                41     50  3 INZ
> >      D fcstum6                51     60  3 INZ
> >      D fcstum7                61     70  3 INZ
> >      D fcstum8                71     80  3 INZ
> >      D fcstum9                81     90  3 INZ
> >      D fcstum10               91    100  3 INZ
> >      D fcstum11              101    110  3 INZ
> >      D fcstum12              111    120  3 INZ
> >
> >      DgetPlanedSales   PR              *
> >      D itnbr                         15a   CONST
> >      D year                           4p 0 CONST
> >      D seq                            3p 0 CONST
> >
> >      PgetPlanedSales   b                   export
> >      DgetPlanedSales   PI              *
> >      D itnbr                         15a   CONST
> >      D year                           4p 0 CONST
> >      D seq                            3p 0 CONST
> >
> >      dplan             S             11p 3 DIM(12)
> >      dp_plan           s               *   INZ(%addr(plan))
> >      dx                s              2  0
> >      DseqKey           S              2  0
> >      Dlen              S             10i 0
> >
> >      c                   if        not %open(Sls600wfl)
> >      c                   open      sls600wfl
> >      c                   endif
> >
> >      C     key           klist
> >      c                   kfld                    year
> >      c                   kfld                    seqKey
> >      c                   kfld                    itnbr
> >
> >      c                   reset                   plan
> >      c                   eval      seqKey = seq
> >
> >      c     key           setll     Sls600wfl
> >      c                   dou       %eof(Sls600wfl)
> >      c     key           reade     Sls600wfl
> >      c                   if        %eof(Sls600wfl)
> >      c                   leave
> >      c                   endif
> >
> >      c                   for       x = 1 to 12
> >      c                   eval      plan(x) = plan(x) + dsPlan(x)
> >      c                   endfor
> >
> >      c                   enddo
> >
> >
> >      c                   return    p_plan
> >
> >      P                 E
> >
> > If I look at the plan array in the subprocedure in debug,
> it shows valid
> > data. the pointer address is returned to the main
> procedure, but if I look
> > at the sales array in the main procedure, I get garbage, ie
> Decimal Data
> > Error. I need a beer!!
> >
> > Thanks,
> >
> > Mark
>
> _______________________________________________
> 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
> 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 thread ...

Follow-Ups:

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.