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



On Wed, Sep 23, 2015 at 2:13 PM, John Yeung <gallium.arsenide@xxxxxxxxx>
wrote:

Let's say I have a nullable variable call MYVAR. And let's say that
its null indicator is currently on. So in SQL, MYVAR is simply equal
to NULL. But in RPG, I can do this:

myvar = 5; // null indicator is not affected
x = %nullind(myvar); // x = '1'
y = (myvar > 2); // y = '1'

In SQL, MYVAR > 2 would be False, since any comparison with NULL is
False.


​No, no it wouldn't and no, no it isn't...

In SQL,
when MYVAR is NULL
​ then ​
MYVAR > 2 is unknown; neither true or false.

​If as you say MYVAR > 2 was FALSE, then NOT (MYVAR > 2) would be true and
it's not.

I'm sure you realize this, but it just goes to show how easy it is to screw
up 3 valued logic.

Going back to the OP, if expiration date is nullable with NULL standing in
for NO EXPIRATION, then​ the only way to return a list of non-expired
records would be to
select *
from myfile
where myexp is null or myexp > CURRENT_DATE

You can pull a list of expired records with a simple
select *
from myfile
where myexp <= CURRENT_DATE

And boolean logic would tell you that this should give non-expired
records...
select *
from myfile
where NOT (myexp <= CURRENT_DATE)

But it won't when myexp contains a NULL value.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.