Returning NULL from parallel routines

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
IASAQ
Premium Member
Premium Member
Posts: 31
Joined: Wed May 04, 2016 11:07 am
Location: Montréal

Returning NULL from parallel routines

Post 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.
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
IASAQ
Premium Member
Premium Member
Posts: 31
Joined: Wed May 04, 2016 11:07 am
Location: Montréal

Post by IASAQ »

Ah, nice. I'll do a test with this later on and see if its works.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Do a search of the IBM Knowledge Center for the difference between out-of-band and in-band null representation.

Mike
Post Reply