Page 1 of 1

Returning NULL from parallel routines

Posted: Mon Jul 18, 2016 4:31 pm
by IASAQ
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.

Posted: Tue Jul 19, 2016 10:19 am
by UCDI
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.

Posted: Tue Jul 19, 2016 4:41 pm
by ray.wurlod
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).

Posted: Wed Jul 20, 2016 8:59 am
by IASAQ
Ah, nice. I'll do a test with this later on and see if its works.

Posted: Wed Jul 20, 2016 9:31 am
by Mike
Do a search of the IBM Knowledge Center for the difference between out-of-band and in-band null representation.

Mike