|
Terri,
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.
Schadd Gray
Damon Technologies, Inc.
www.damontech.com
----- Original Message -----
From: <THarteau@xxxxxxxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, October 01, 2003 10:05 AM
Subject: More problems w/passing data structures as parameters
>
> Hi,
> I appreciate all the help I have gotten from the list so far, but I
> have another problem. I am passing a data structure as a parameter to a
> procedure, and when I execute a shell program to test it, I get the
message
> 'Pointer not set for location referenced' & 'Pointer or Parameter error
> (CGDF). I am trying to follow an example I found in the Club Tech
> Newsletter, and I can't see where I went wrong. All the modules and the
> shell compiled OK, and the CRTPGM was OK. Any and all advice is greatly
> appreciated.
>
> This is the /copy I am using (PROINV)
>
> // ---------------------------------------------Prototype: DescClass
> D DescClass PR N
> D ItemInfoDS LikeDS(ItemInfo)
> D ItemInfo DS Based(ItemInfoPtr)
> 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 DscOut = IDESC
> C Eval 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 S Like(ItemInfo)
>
> /FREE
>
> Eval ItemIn = ParmItm;
> Eval DscOut = *blanks;
> Eval ClsOut = *blanks;
> ReturnInd = DescClass( ItemInfoDS );
> Dsply ItemIn;
> Dsply DscOut;
> Dsply ClsOut;
>
> *INLR = *ON;
> Return;
>
> /END-FREE
>
> <===================================================>
>
> Terri Harteau
> Felker Brothers Corp.
> ****************
> "There's no point in being grown up if you can't be childish sometimes."
> - Dr. Who
> ****************
>
>
>
>
>
>
> _______________________________________________
> 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-2025 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.