On 2012-09-15, at 1:00 PM, rpg400-l-request@xxxxxxxxxxxx wrote:

I would love to see some RPG examples of this.

Simplest one of all:

D myBigField s 20000a Inz
D myBigVaryField s 20000a Inz Varying

D data s 40a Inz('Only 12 used')

D comma c ','

D i s 5i 0 Inz

/Free

For i = 1 to 1000;
myBigField = %TrimR(myBigField) + %TrimR(data) + comma;
EndFor;

For i = 1 to 1000;
myBigVaryField += %TrimR(data) + comma;
EndFor;

*InLR = *On;

Try this and you'll see that the second (varying) version is orders of magnitude faster. I've seen differences in excess of 1,000 times. I've also seen versions worse than the first one in that they used %Trim in both cases and not %TRimR.

And before anyone points it out, yes I know I probably don't want a comma at the end of the data ;-)


Jon Paris

www.partner400.com
www.SystemiDeveloper.com





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.