|
This method gets complicated when a procedure has several of those parms and needs to use them to call another procedure later. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of AGlauser@xxxxxxxxxxxx Sent: Wednesday, August 30, 2006 9:32 AM To: RPG programming on the AS400 / iSeries Subject: RE: Allocate field with options(*nopass :*omit) If you are concerned about copying the parameter value, what about: p example B export d pi 10i 0 opdesc d piParm1 32767 const options(*varsize:*nopass:*omit) d piParm2 32767 const options(*varsize:*nopass:*omit) d p1Exists N d p2Exists N /free if %parms() >= 1; p1Exists = *on; endif; if %parms() = 2; p2Exists = *on; endif; if p1Exists .... Do something else .... Do something else endif if p2Exists .... Do something else .... Do something else endif /end-free Hope this helps, Adam P.S. - Sorry if font is small ... I'm trying to figure out why this happens. rpg400-l-bounces@xxxxxxxxxxxx wrote on 30/08/2006 10:24:02 AM:
I might be wasting my time to gain some insignificant amount of efficiency. Here is my thought: Using below as an example, won't it
be
a waste of cpu to have to copy those two big optional fields to temporary fields for every single execution? p example B export d pi 10i 0 opdesc d piParm1 32767 const options(*varsize:*nopass:*omit) d piParm2 32767 const options(*varsize:*nopass:*omit) -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Peter Levy Sent: Wednesday, August 30, 2006 8:56 AM To: RPG programming on the AS400 / iSeries Subject: Re: Allocate field with options(*nopass :*omit) Unfortunately what you want to do can't really be done. Given that
your
parameter is a constant you can only have a local variable with a default value (as has already been suggested). If you changed your parameter by removing the "const" keyword you could do something like this: P test B D test pi D piParm1 10a options(*nopass) D pi s like(piParm1) based(piPtr) D piPtr s * inz(*null) C if %parms() >= 1 C eval piPtr = %addr(piParm1) C else C alloc %size(piParm1)piPtr C endif C if pi = *blank C* .... Do something C else C* .... Do something else C endif C if %parms() < 1 C dealloc(n) piPtr C endif p test E However it's hardly worth the effort. Better to use the local
variable.
-- 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.
######################################################################## ############# Attention: The above message and/or attachment(s) is private and confidential and is intended only for the people for which it is addressed. If you are not named in the address fields, ignore the contents and delete all the material. Thank you. Have a nice day. For more information on email virus scanning, security and content management, please contact administrator@xxxxxxxxxxxx ######################################################################## #############
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.