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



+1

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Friday, March 27, 2015 8:10 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: RPG String Compare - Bug or not?

On Fri, Mar 27, 2015 at 9:06 AM, Ken Sims <mdrg8066@xxxxxxxxxxx> wrote:
On Fri, 27 Mar 2015 10:19:23 +0000, Thomas Raddatz
<thomas.raddatz@xxxxxx> wrote:
It does not explicitly mention varying fields and I completely agree for fix-length fields. But for varying fields, for example, a field with length = 0 is different from a field with one or more spaces.

What is your opinion about that?

My opinion is that it is working as designed.

There's no question it's working as designed. The only question is whether that's a flawed design.

If the compiler was coded so that varying fields had to be the same
length to be considered equal, then people who didn't care about the
length being equal would have to move the varying fields to fixed
length fields to do a comparison. The way it is now is more
programmer-friendly.

The way it is now is only more programmer-friendly from the point of view of someone who wants it to be the way it is.

To anyone who is expecting and wanting what Thomas wants, it is very decidedly NOT more programmer-friendly. (You even demonstrated yourself that to achieve what he wants to achieve, he has to throw in more code.)

My opinion is that the way most other languages do strings is better than the way RPG does strings. But that's my preference. Given RPG's roots, I think that the way RPG handles varying-length strings is actually quite reasonable. It's "backward compatible-ish" while providing some additional benefits. It just fits better into RPG to do it the way they've done it, I think.

John
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.