|
Scott, What about MODS? Would all occurrences be available? > -----Original Message----- > From: rpg400-l-bounces@xxxxxxxxxxxx > [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement > Sent: Tuesday, May 23, 2006 6:23 PM > To: RPG programming on the AS400 / iSeries > Subject: Re: Pointer / Based issue > > > Steve, > > You don't have to pass a pointer to the data structure. When > you pass a field, and don't include VALUE or CONST on the > prototype, a pointer will be passed under the covers. > However, the fact that you don't manually code the pointer > logic allows the compiler to do better validity checking and > makes it easier for the caller, since he doesn't have to do > any pointer logic. > > Also, if you _do_ use CONST, but the caller's definition for > the parameter is identical to the subprocedure's, then it'll > still be passed by pointer under the covers. Coding VALUE > will guarantee that it's not passed by pointer -- so you > don't want to do that :) > > For example: > > d FeatTypeDS ds Qualified > d dsFeat 3 dim(1000) > d dsType 2 dim(1000) > . > . > > if ErrorsInDS(FeatTypeDS); > .. do whatever .. > endif; > . > . > > P ErrorsInDS B > D ErrorsInDS PI 1N > D Feat likeds(FeatTypeDS) > /free > for x = 1 to %elem(Feat.dsFeat); > if Feat.dsType(x) = 'AB'; > .... do something ... > endif; > endfor; > /end-free > P E > > This is just so much more elegant than passing a pointer > directly.. The only time I'd pass a pointer directly is when > you're deliberately using a pointer rather than something > like a data structure, or when you want the routine to be > available to any data type. > > --- > Scott Klement http://www.scottklement.com > Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.
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.