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



Correct.  He will also need to clarify the data structure field names with
the data structure name to insure the proper fields are updated (because fo
the likeds).

I should have been more clear.  The reason for his post was a pointer error.
The reason he is getting the pointer error is because he has defined his
data structure based on a pointer (via the like definition) and he did not
allocate any memory to that pointer.  Removing the "BASED" keyword is just
one of a few different solutions.

His code should look like this:

This is the /copy I am using (PROINV)

   // ---------------------------------------------Prototype: DescClass
 D DescClass       PR              N
 D  ItemInfoDS                         LikeDS(ItemInfo)
 D ItemInfo        DS
 D  ItemIn                       15
 D  DscOut                       30
 D  ClsOut                        2

This is the inventory procedure (DESCCLASS)

H  NOMAIN
 *  External procedure for DESCCLASS

 /COPY QPROSRC,PROINV

  ////////////////////////////////////////////////////////////////////
  //  Procedure to return the description & item class for an item.

PDescClass        B                   EXPORT
D DescClass       PI              N
D  ItemInfoDS                         LikeDS(ItemInfo)
D*
D IDESC           S             30    INZ(*blanks)
D ICLAS           S              2    INZ(*blanks)
C*
C/EXEC SQL
C+ SELECT idesc, iclas INTO :idesc, :iclas FROM iim WHERE iprod =
C+ :ItemIn
C/END-EXEC
C*
C                   Eval      ItemInfoDS .DscOut = IDESC
C                   Eval      ItemInfoDS .ClsOut = ICLAS
C                   Return    *off
C*
PDescClass        E

And this is the shell program I am executing

 /If Defined(*CRTBNDRPG)
H DftActGrp(*NO) ActGrp(*Caller)
 /EndIf

F*   Shell program to test inventory procedures.
D*
D Main            PR                  EXTPGM('SHELLINV')
D                                2
D                               15
D*
D Main            PI
D  ParmItm                      15

 /COPY QPROSRC,PROINV

D ReturnMPG       S              5
D ReturnDS        S             47
D ReturnInd       S               N
D ItemInfoDS      DS                   LikeDS(ItemInfo)

 /FREE

  Eval ItemInfoDS .ItemIn = ParmItm;
  Eval ItemInfoDS .DscOut = *blanks;
  Eval ItemInfoDS .ClsOut = *blanks;
  ReturnInd = DescClass( ItemInfoDS );
  Dsply ItemInfoDS .ItemIn;
  Dsply ItemInfoDS .DscOut;
  Dsply ItemInfoDS .ClsOut;

  *INLR = *ON;
  Return;

 /END-FREE

Schadd Gray
Damon Technologies, Inc.
www.damontech.com

----- Original Message ----- 
From: "Scott Mildenberger" <scottmildenberger@xxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, October 01, 2003 1:00 PM
Subject: Re: More problems w/passing data structures as parameters


> Actually, if you just removed the based keyword the procedure
> would be updating the data structure in the /copy member and not
> be using the parameter at all.  That would not be a good thing!
>
> Scott Mildenberger
>
> --- Schadd Gray <list@xxxxxxxxxxxxx> wrote:
> > What you are missing is the fact that your data structure
> > ItemInfo is based
> > on a pointer.  If you remove the based keyword from that data
> > structure it
> > will work.  In your code you are passing the data structure,
> > not a pointer
> > to it.
> >
>
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
> _______________________________________________
> 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 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.