|
Scott / Barbara Thanks for the advice. Sometimes in an effort to make code more efficient we overlook the obvious. We changed the procedure interface to pass the DS by reference and exclude the pointer. We haven't got all the other kinks worked out yet but we should be okay. Again, Thanks. S. Ellsberry (678) 893-6673 steve.ellsberry@xxxxxxxxxxxx -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris Sent: Tuesday, May 23, 2006 9:41 PM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Pointer / Based issue "Ellsberry, Steve" wrote: > ... > In the service program I have the procedure interface defined as > p ErrorsInDS pi n > PointerPassedIn * > > I also have a data structure in the procedure defined as > d FeatTypeDS ds Qualified > Based(PointerPassedIn) > d dsFeat 3 dim(1000) > d dsType 2 dim(1000) > ... > The DS is the service program contains all asterisks. > Steve, the problem you are seeing is due to a limitation of the debugger. It can't evaluate any variable that is based on a pointer that is itself based. (A parameter passed by reference is considered "based" on the address of the passed parameter.) Good advice: Do what Scott suggested and code the procedure to pass the data structure by reference instead of passing its address. Bad advice: You _could_ solve the debug problem by copying the pointer to a local pointer, and basing your data structure on the local pointer. Or by passing the parameter by value. But in some cases it's unavoidable to have based-on-based situations. The RPG debugger uses the -> syntax to get around the problem: ===> EVAL PointerPassedIn->FeatTypeDS or ===> EVAL PointerPassedIn->dsFeat ===> EVAL PointerPassedIn->dsType If the DS also had a pointer subfield dsPtr, and some other field say fldx was based on that pointer, you could do ===> EVAL PointerPassedIn->dsPtr->fldx etc. -- 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.