|
I gave Bobs article a quick look. What I saw was this:
------------
D ToUpper PR 10I 0
D InString 32766A Const Varying
D OutString 32766A
OPTIONS(*VARSIZE)
The second parameter now becomes the target of the
conversion, and the OPTIONS(*VARSIZE) allows you to pass a
parameter whose length is 1 to 32766 bytes. You simply use
%LEN(InString) inside the subprocedure to determine how
much data was actually passed to your subprocedure. Then,
be sure to "touch" only that many characters in the
OUTSTRING parameter.
--------------
1. Wouldn't you need to use %len(%trimr(InString)) because
if the input parm used in the calling program is NOT a
variable length field or a literal it won't be correct.
2. Couldn't you just use:
D ToUpper PR 10I 0
D String 32766A
OPTIONS(*VARSIZE)
And use the same parameter for input and output? Wouldn't
that cut down on the amount of storage that is allocated
when the procedure is called?
And would you really need or want to use *VARSIZE? You
could use %len(%trim(String)) or CHECKR to get the length
of the field.
Or as I have seen in other exaples pass the length along
(which you'd need to do in either place, where it happens
in the program or in the procedure, I wouldn't think it
would matter).
Searching the archives on this subject you can really see
the evolution of this subject. :)
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.