On a parallel routine that has a char* return value, I tried to return "", 0 and NULL from the routine to a stage variable but none of these returned true with IsNull when I checked.
Is there a special value I should return from my parallel routine so that IsNull, NullToValue etc will properly evaluate to true? Could be an hexadecimal value, could be something else.
Returning NULL from parallel routines
Moderators: chulett, rschirm, roy
something like if len (x) = 0 setnull() else x ...
should work for you.
The strings you are providing are not null, they are empty. "" and an ascii value of 0 in the first character position are both empty strings, but the "null" character of zero is not the same as the null in a database which is different from an empty string.
Do you need both empty strings AND null strings, or NULL values?
If you need both, you will want a sentinel value so you get instead
if x = sentinel setnull() else if len(x) = 0 "" else x
(this is redundant, as else x will pass through empty strings, the logic is extra explicit for you to understand but in code, just use
if x=sentinel setnull else x
pardon my syntax, but you get the idea I hope.
should work for you.
The strings you are providing are not null, they are empty. "" and an ascii value of 0 in the first character position are both empty strings, but the "null" character of zero is not the same as the null in a database which is different from an empty string.
Do you need both empty strings AND null strings, or NULL values?
If you need both, you will want a sentinel value so you get instead
if x = sentinel setnull() else if len(x) = 0 "" else x
(this is redundant, as else x will pass through empty strings, the logic is extra explicit for you to understand but in code, just use
if x=sentinel setnull else x
pardon my syntax, but you get the idea I hope.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You might try returning \x80, which is the standard DataStage internal representation of null, unless you are using a character set in which the euro character takes this code point.
In that case, check with the uvconfig file to determine how null is to be represented (for example \xa4).
In that case, check with the uvconfig file to determine how null is to be represented (for example \xa4).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.