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



Ken,

On that basis, %trimr would be needed any time that two fixed-length
fields are being compared that are not the same length. Likewise,

The way the compiler compares fixed-length fields is fine for me, because
with fixed-length fields nobody could know how many space are in there.

But for varying length fields the current length of the string is known and
for those fields it is true, that fields with different length (%len() not
%size()) cannot be the same.

I promise not to open a PMR before you are retired. ;-)

Regards,

Thomas.

Am 27.03.2015 um 17:30 schrieb Ken Sims:
Hi Thomas -

On Fri, 27 Mar 2015 13:59:51 +0000, Thomas Raddatz
<thomas.raddatz@xxxxxx> wrote:

I do not agree, that people need to move there varying fields to fix-length fields when they do not want to care about the length. The question is not whether they care for the length, but whether they care for trailing spaces. If I do not care about trailing spaces, then I have to trim my fields according to my needs. That is what people have to do for almost every programming language.

Valid point. %trimr would be far the better option.

I agree, that the compiler works as designed regarding to the documentation. But it works different from the other compilers that I know. Fields whose contents have a different lengths cannot be equal. Whether or not the content are spaces, does not matter.

On that basis, %trimr would be needed any time that two fixed-length
fields are being compared that are not the same length. Likewise,
%trimr would be needed when comparing a field to a constant that is
not the length of the length of the field (unless the constant is
going to be padded with the needed trailing spaces to make the lengths
match).

RPG is what it is, and changing the default behavior (even just for
varying fields) would break lots of code. I suppose it could be an
enhancement activated by an H-spec option.

Or just wait about 16 months until I'm retired, and then I won't care
what is done to the compiler or any other part of the IBM i.

Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.


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.