concatination of stage variables

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sainath
Premium Member
Premium Member
Posts: 138
Joined: Fri Nov 19, 2004 3:57 pm

concatination of stage variables

Post by sainath »

Hi
I am using around 10 stage variables each have different if conditions
and i concatinate all stage variables and insert into a column.
like var1:var2------var10 into Name varchar2(288) field.

My problem is when i concatinate all variables i am getting null but if i test individually each result of variable it is working fine .
I want to know how can we solve this problem
thks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The only way you'll get null from concatenation is if one of the operands is null. The individual expressions should not generate null if you're planning to concatenate. Generate "" or " " instead.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Couple of checkks

- Check for null before you concatenate.
- Replace nulls with a ' ' and check. You can figure out which stage variable is the culprit.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
johnthomas
Participant
Posts: 56
Joined: Mon Oct 16, 2006 7:32 am

Post by johnthomas »

I guess some of the link variables has value as NULL . Can you replace the null with some value and try out.
JT
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

You must be getting one or more stage variables as NULL value which is causing the value of the whole expression to be NULL.

Try by starting with just two, then three and so on. This way you could find out which Stage variable is coming in as NULL.

Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Wow...Too late :)

You can use the following DSTransforms for converting the NULL's

Code: Select all

NullToEmpty

        Or

NullToZero

Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

NullToEmpty would be the proper choice in this case:

Code: Select all

NullToEmpty(var1):NullToEmpty(var2):  <etc>
No need for it on a field you know will never be null, but if there is any doubt...
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply