|
Lim, Number one rule of performance when coding: don't worry about it unless testing shows it to be a problem. Having said that, here a a couple of thoughts: - Use the STATIC keyword on the d-spec for the standalone temporary field. This will prevent the temporary field from having to be recreated every time the procedure is run. - Consider using a VARYING temporary field to limit the amount of data to be moved. HTH, Charles Wilt -- iSeries Systems Administrator / Developer Mitsubishi Electric Automotive America ph: 513-573-4343 fax: 513-398-1121
-----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Lim Hock-Chai Sent: Wednesday, August 30, 2006 10:24 AM To: RPG programming on the AS400 / iSeries Subject: RE: Allocate field with options(*nopass :*omit) 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.
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.