|
Hello!
I've written a procedure that returns a value of type varying length string. Because I want to let the maximum size of the field in the calling programm open, the size of the return field is defined with 65535 bytes.
Independently of the number of bytes to be returned, the call of the procedure is very slow (time job running was 19 seconds). When I define the return field like the input field with 255 bytes the call is faster (runtime only 1 second).
Why that? I would expect, that only characters needed and length information are copied to the calling procedure. Not the hole storage area.
Here my coding example (V5R2): * ------------------------------------------------------------------ d #str1 s 65535 varying d #str2 s 255 varying d inz('Let the sun shine!') d TSTPRC2 pr 65535 varying d 255 varying c do 200000 c eval #str1 = TSTPRC2(#str2) c enddo c eval *inlr = *on * ------------------------------------------------------------------ h nomain d TSTPRC2 pr 65535 varying d 255 varying p TSTPRC2 b export d pi 65535 varying d $InpStr 255 varying d #RtnStr s 65535 varying c eval #RtnStr = $InpStr c return #RtnStr p e * ------------------------------------------------------------------
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.