|
I just did a (very) short article on this in my Midrange Developer newsletter. The solution is to pass parameters along with perhaps the length of the data (if necessary). This will avoid temporary variables from being created and returned. Also with a reference parm that will be updated, no temp variable is created. For some large parameters that are passed by VALUE or CONST, you do get the temp work variable being declared, and your data is copied to that temp value which is subsequently passed to the subprocedure. You can't do anything about this for VALUE parms, however for CONST parms, you can add the OPTIONS(*VARSIZE) and the compiler will avoid creating a temp variable and copying your data to it before passing. I know IBM is working on this but that doesn't help up now. It is unfortunate that a similar issue was raised/red-flagged back in the late 1980s when IBM initially implemented the so called "String Opcodes" in RPGIII. When SCAN/CAT/XLATE/CHECK came out, I ran a test using a 6000-byte work field. The implementation of these opcodes was so poorly designed that they actually created copies of your Factor 1, Factor 2 and Result field and then did the operation and copied the data back to your variable. I was on the phone discussing it with the developer (how is now the RPG Manager) and talked him into changing it. It is disappointing that something similarly poor in resource utilization has made its way into such a vital part of RPG IV. -Bob Cozzi -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Brad Stone Sent: Thursday, May 20, 2004 7:47 AM To: RPG programming on the AS400 / iSeries Subject: Large Return values (was Re: Variable Length Field Question) Ya, I've heard about this as well. Is the suggestion then to return pointers? Does this also apply to passing parameters that are large values, or just returning large values? Brad On Thu, 20 May 2004 11:48:34 +1200 "Peter Connell" <Peter.Connell@xxxxxxxxxxxxxxxxxxxx> wrote: > Brad, > A warning on large variable length return values. > > Previous responses I've had on this list by the IBM guys > indicate that > it appears the compiler has not been designed to > accommodate these as > well as might be hoped. _______________________________________________ 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-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.