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



What's a "NULL Variable"?
Do you mean a field that can contain a X'00' or is considered null (as in
*NULL in RPG IV)?
Does Oracle use null-terminated strings? If so, then a pointer to a null
value is an empty string. A null pointer is the same in Unix-based C as it
is in RPG IV, for the most part. 
Often C compilers map a 0 or X'00' to the word "null". 
So  if (mystring == null) means, does the field contain a X'00' in position
1 (or offset zero of you're a C person).
In RPG IV, you can use %str() to move from/to null-terminated strings. But
you're right, there is not "full null support" (whatever that might mean,
but I agree that it seems that way).

So if the l-value's length is ZERO, how many 9's should it be compared with
in order for it to be false? Based the way *ALL'9' works, by matching its
corresponding value's length, that would be zero 9's. Hence, they would be
equal.
I've written tons of C code, and often have to check for a null address/ptr
as well as a null value (pointing to X'00') to make sure I'm not screwing
things up. Doing the following in this case, doesn't seem to strange. 
I think this is just one of education, and acceptance. Now let's get on with
the real problems in RPG IV, like hyphens in opcode names! <vbg>

if %len(%Trim(myField)) > 0
    and %Trim(myField)= *ALL'9'
// now we're cookin'
endif 

-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Wilt, Charles
Sent: Friday, January 27, 2006 1:52 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: %Trim dilemma

That's debatable, particularly when dealing with a language, like RPG,
that doesn't provide full NULL support.

If you consider strings to be sets of characters, then you'd consider
that in set theory the NULL set and the EMPTY set are one and the same.

Interesting tidbit, Oracle treats EMPTY strings as NULL strings and vice
versa.

However, given that DB2 doesn't treat NULL strings as EMPTY strings, and
given that RPG doesn't support NULL variables, I probably should have
said empty instead of NULL <grin>


Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
  

> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx 
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of 
> Matt.Haas@xxxxxxxxxxx
> Sent: Friday, January 27, 2006 2:10 PM
> To: rpg400-l@xxxxxxxxxxxx
> Subject: RE: %Trim dilemma
> 
> This isn't comparing null strings. It's comparing empty 
> strings which is
> very different from null.
> 
> Matt 
> 


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.