|
On 2/12/2016 8:22 PM, Brian Johnson wrote:
In #test_test wouldn't the assignment of '?' to parameter named input beExactly right. Here's what the manual says about *VARSIZE:
padding with 65534K blanks and overwriting who-knows-what in memory?
"When OPTIONS(*VARSIZE) is specified, the passed parameter may be shorter
or longer in length than is defined in the prototype. It is then up to the
called program or subprocedure to ensure that it accesses only as much data
as was passed. To communicate the amount of data passed, you can either
pass an extra parameter containing the length, or use operational
descriptors for the subprocedure. For variable-length fields, you can use
the %LEN built-in function to determine the current length of the passed
parameter."
Bradley, if you just want the called procedure to be able to use the
parameter's value, it would be much safer to make the parameter varying
length. Then the called procedure could get the length by checking %LEN. If
you want the procedure to get the trimmed value of the parameter, code
OPTIONS(*TRIM), although that will trim both left and right.
If you want the procedure to be able to modify up to the full length of
the passed parameter, I think your second parameter should be the size of
the passed parameter, not the trimmed size. The procedure could figure out
the trimmed length itself by using
%len(%trim(%subst(parm:1:parmsize)))
--
Barbara
--
This is the RPG programming on the IBM i (AS/400 and 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.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
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.