× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hans,
So are "we" working on getting that pushed down into the W-Code for V5.3?
I've got "tons" of 64K VARYING fields on my procs all over the place. Yikes!


Bob Cozzi
Cozzi Consulting
www.rpgiv.com

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Hans Boldt
Sent: Wednesday, November 26, 2003 7:37 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Low performance on varying length field

Titus Kruse wrote:

> 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
>  * ------------------------------------------------------------------
> 

I think Scott already addressed the issues, but I'd like to put a 
different perspective on this. It simply boils down to one thing: 
Varying length strings in RPG IV are handled by RPG, and not by the 
underlying W-Code. Operations handled by RPG can be done efficiently, 
dealing with only the number of bytes required. But operations that are 
left to W-Code are less speedy since W-Code doesn't understand the 
implementation of varying length variables, and so deal with the 
aggregate as a whole. When passing varying length string values as 
parameters or when returning varying length values, W-Code moves around 
the whole aggregate, not just what is specified by the current length.

Cheers! Hans


_______________________________________________
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 thread ...

Replies:

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

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.