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



Charles,

Further on in the reference:

The empty string is still a string upon which string operations may be attempted.

'string operations' are =, >, <, concatenation, etc.

An empty string is not a null but it is a null string (not the same thing although the reference says some languages treat them the same). Think of it as a pointer to a null but the pointer itself (string) is not null.

Paul Morgan

Principal Programmer Analyst
IT Supply Chain/Replenishment

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Tuesday, October 11, 2011 12:44 PM
To: RPG programming on the IBM i / System i
Subject: Re: RPG Error or ?

I think the "empty string is not null" is debatable...

In fact the wiki page you provided a link to says "the empty string
(or null string)[1] is the unique string of length zero"

So it disagrees with your assertion... :)

In any event, even if we consider an empty string to be non-null, I
agree with Jon that the only tests that make sense is EMPTY and NOT
EMPTY...

IMO, The proper why to test for EMPTY in RPG is using %len() = 0.

Charles

On Tue, Oct 11, 2011 at 12:01 PM, Morgan, Paul <Paul.Morgan@xxxxxxxxxxx> wrote:
Jon,

Your mental model of Nullness doesn't match here.  An empty string is not a null.   It does have a value which is 0 characters so you can compare two empty strings (=, >, <).  Nulls you can't even compare against each other.  Null = Null is always false.  You can only test for a null (if X is null) which I believe is what you're trying to say here.

http://en.wikipedia.org/wiki/Empty_string

Paul Morgan

Principal Programmer Analyst
IT Supply Chain/Replenishment

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Tuesday, October 11, 2011 11:44 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: RPG Error or ?


On Oct 11, 2011, at 11:16 AM, rpg400-l-request@xxxxxxxxxxxx wrote:

To me it isn't logical,

if you reset a variable field to "no value" you do it with

string = '';

%len(string) will display 0

so why is a compare with '' not equal to the setting of the field while
it (whatever there may be in memory) works if you do


Others have explained why it didn't work, but to me your original comparison was illogical. I have no concept (although you clearly do) of what "greater than null" means. Nullness surely can only be tested for existence or non-existence. So I expect If x <> ''; to work and If x = ''; But not < or > than.

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.



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.