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



Albert,

This is my opinion only...

It depends upon what you are using workfield for. If you are not in a high transaction situation it probably doesn't matter. If you are in a high transaction situation using string length + string data probably faster. Over the length of processing the nanoseconds you save not having to clear unused data will add up.

HTH,

Gary Monnier


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Albert York
Sent: Monday, May 21, 2012 2:06 PM
To: RPG programming on the IBM i / System i
Subject: Re: Clear entire field vs substring

I don't care about any left over data.

I am wondering if it is faster to clear the entire field, even if I am only going to be using the first 10 bytes (for example).

Thanks,

Albert

On Mon, May 21, 2012 at 1:16 PM, <Tommy.Holden@xxxxxxxxxxxxxxxxxxxxx> wrote:
Clearing the substring does exactly that...clears the data from those
positions in the variable.  IF there is data beyond that substring it
WILL not be cleared.  So unless you are ok with potentially
"left-over" data clear the entire field and not just a substring.  If
you are only wanting to clear the existing data, just clear the field
and forget substring. Why add overhead/complexity where it simply isn't needed?





From:   Albert York <alfromme@xxxxxxxxx>
To:     "RPG programming on the IBM i / System i"
<rpg400-l@xxxxxxxxxxxx>,

Date:   05/21/2012 02:57 PM
Subject:        Re: Clear entire field vs substring Sent by:        
rpg400-l-bounces@xxxxxxxxxxxx



I guess I didn't make myself clear.

Forgetting the details, is it better to clear an entire field or to
clear a subscripted portion of the field. Which incurs more overhead?

Thanks,

Albert

On Mon, May 21, 2012 at 12:16 PM, Vern Hamberg <vhamberg@xxxxxxxxxxx>
wrote:
I thought simply assigning the value to the variable did the blanking
out first - this isn't a MOVE or MOVEL, which are different.

Is workfield a varying-length field? Then all you need to do is this
-

workfield = %trimr(Newdata);

HTH - and that I'm right, cuz I hardly ever initialize, then assign
anymore!
Vern

On 5/21/2012 2:09 PM, Albert York wrote:
I have a work field that is 2000 bytes (to allow for the longest
possible string value). The length of the data being moved to it
varies and can be quite short. I have to clear the work field before I
move the data.

  Which is better:

  workfield = *blanks


  len = %len(%trimr(Newdata));
  %substr(workfield:1:len) = *blanks;

  Thanks,

  Albert
--
This is the RPG programming on the IBM i / System i (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.

--
This is the RPG programming on the IBM i / System i (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.


--
This is the RPG programming on the IBM i / System i (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.

--
This is the RPG programming on the IBM i / System i (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.