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



On Mon, May 21, 2012 at 5:28 PM, Albert York <alfromme@xxxxxxxxx> wrote:
Assuming there is a reason I have to clear the data before starting,

This is a big (and I would guess rather crazy) assumption. If you
happen to be able to describe a situation where this is the case, I
would be interested to hear it.

which is faster:

workfield = *blanks

or

%substr(workfield:1:len) = *blanks

Well, %substr doesn't work at all, but maybe you mean %subst. ;)

The answer is that on a model 810 running V5R2, blanking out a small
substring is faster than clearing the entire field of 2000 bytes,
potentially several times faster, if you are clearing only a tiny
portion of the field. I don't know the underlying low-level code, I
just wrote a simple-minded RPG program to try various things.

I cannot stress enough, though, that I don't know a legitimate use
case for explicitly pre-clearing a field. And I still recommend human
source readability over micro-optimization. (Otherwise, why aren't we
all programming in assembly? Or lower?)

If you do not explicitly pre-clear the field, you have the best of all
worlds - fastest (because no-op is faster than any op) and clearest
source code (zero lines of superfluous code is easier to write, read,
and maintain than some positive number of lines of superfluous code).

John

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.