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




No, not Forth, RPG.

Norm Dennis


----- Reply message -----
From: "Albert York" <alfromme@xxxxxxxxx>
To: "RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
Subject: Clear entire field vs substring
Date: Tue, May 22, 2012 07:42


Thanks everyone.

I will go forth and clear no more;

Albert


On Mon, May 21, 2012 at 3:00 PM, Vern Hamberg <vhamberg@xxxxxxxxxxx> wrote:
You don't - but why even do this when you set the varying field to some
value - esp. if that value is a varying one, whether it is the result of
a %trim operation or some other - almost all the string operations now
return varying-length values.

I am going to take a firm stand!!! Watch out!!!

There is almost no need ever at all to blank out or initialize character
fields/variables in RPG anymore!!!

Just set the blame thing and be done with it. And be careful to trim
fixed-length values.

OK, soapbox has officially fallen apart!

Vern

On 5/21/2012 4:25 PM, Alan Campin wrote:
If I have a varying field, I just do a %Len(WorkField) = 0 Why would I need
to move in blanks.

On Mon, May 21, 2012 at 3:22 PM, Jon Paris<jon.paris@xxxxxxxxxxxxxx>  wrote:

On 2012-05-21, at 3:54 PM, rpg400-l-request@xxxxxxxxxxxx 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:
Neither are necessary.

An eval will always clear unused bytes in the back end of the string.

I think Chuck is wrong about the varying in that I'm fairly certain that
it actually places blanks in the back end of the field even though (because
of the length) it doesn't need to. It certainly pads when you use %Len to
increase the field length. I seem to recall a conversation with Barbara
where she told me that they had decided that setting the back end of a
varying to blanks was probably a waste of time but by then couldn't change
the behaviour because undoubtedly someone had decided it was a "feature" by
then.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com




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

Follow-Ups:

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.