× 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.



Thanks Hans, but I don't think I can use %CHECK on V4R5 with the EVAL
operation, can I???
With less than 30 percent of the people on V5Rx yet, I don't think I
want to publish code that doesn't work on V4R5. But maybe in 2003!

Bob

> -----Original Message-----
> From: rpg400-l-admin@midrange.com
> [mailto:rpg400-l-admin@midrange.com] On Behalf Of Hans Boldt
> Sent: Wednesday, June 12, 2002 7:42 AM
> To: rpg400-l@midrange.com
> Subject: Re: right$
>
>
> Bob Cozzi wrote:
> > %trimR is expensive? I though only %trim was expensive.
> > Since you wrote %TRIMx why don't you make them work faster!
> :) Also,
> > another argument for an INLINE keyword as the overhead of using a
> > procedure call far outweighs using %TRIMR in that procedure.
>
> Well, the statement in question is "Eval InString=%Trimr(InString)".
>
> First, is %TRIMR expensive?  %TRIMR is implemented by a loop
> that searches backwards through the string character by
> character until a non-blank is found.  Well, that's not too
> bad, unless you have a lot of trailing blanks.
>
> Second, is string assignment expensive?  Well, in this case,
> you're copying character by character from the expression to
> the target for the length of the source string.
>
> But if you're trimming the right-most blanks from a varying
> length character variable, there's a faster way to do it:
>
> eval %len(string) = %checkr(' ':string);
>
> In this case, you're searching for the right-most non-blank,
> and assigning the position of that character to the length of
> the character varying string.  If the entire string is blank,
> then %CHECKR returns 0, and the length of the string is set to 0.
>
> Sure, %CHECKR involves it's own loop through the string, but
> in this case, there's no assignment of possibly lots of
> characters to the assignment target.  A quick test showed
> improvements from around 10% to 35%, with greater improvement
> as the number of trailing blanks increased.  This suggests
> that %TRIMR may well be the bottleneck.
>
> (OK, the performance improvement isn't that great, and may
> not necessarily be worth it overall.  I was just expecting
> bigger gains than that.  Like I said, yesterday afternoon I
> was in a nitpicky mood!)
>
> Cheers!  Hans
>
>
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> 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 ...

Follow-Ups:
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.