Concatination Problem for Tab delimited file

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
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

Concatination Problem for Tab delimited file

Post by vivek »

Hi All,
I have two columns comming from a Tab delimited file.One of them is Reference(Varchar) where the other is Rate( Float.)
My requirement is to concatenate them and put in to a Varchar field(Oracle).
example data: REFERENCE
prime
split
YRP
Nkl
rto


RATE

20.2
0.5
0.5

etc.......
i am able to concatenate them both, but it is not giving results if the rate column is empty.Also i have written a small routine to give @null as well empty('') exceptions.But still the the result is not there for where ever there is a null in the rate field.
i.e the end result is like this
prime 20.2
split 0.5
YRP 0.5
.........
.........
........
the dotted lines i represent means there is no data in the resultant column. is there any thing i am missing?
Version 7.5.1 server
Any help is appriciated.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Work on the other way, Check for null and give an empty character '' instead.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Other options could be Len(col2)=0
or Col2=""
or isNull(Col2)
or Col2=@NULL.STR
Success consists of getting up just one more time than you fall.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

loveojha2 wrote:Other options could be Len(col2)=0
or Col2=""
or isNull(Col2)
or Col2=@NULL.STR
Checked all the possible condition :wink:
But needless to check for empty string on a Float column.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

Post by vivek »

Kumar and Loveojha
Thanks for your fast replies.
I have already tried "" but it wasn't working.
just now itried to make as IF len(column)=0
and it's just working fine.


If any one can through some light on how data stage recognizes a Null field that would be awesome.

Once again thanks alot.
pkomalla
Premium Member
Premium Member
Posts: 44
Joined: Tue Mar 21, 2006 6:18 pm

Post by pkomalla »

I tried with the specification you gave, the results were fine. I got refernce column value when rate is null. results are
sap20.5
yrs
tmp10

I used -- refernce:rate as output column value in transformer

You can try with If len(rate)=0 then reference else reference:rate
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

Post by vivek »

But My question is can't we use the term"@null" and why?
Folks any idea on that??
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Usually checking for null from a flat file is hard unless it has the control character ^@ which represents a null. Usually flat files dont have such un-printable characters or they are stripped implicitly. Thats why a null check wont work even though to a naked eye it does look like null. Thats where the len() functions really helps to see if the length is 0.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can not sensibly perform comparisons with @NULL (the unknown value); the answer can only be "don't know".

I have an object in each of my hands. Please answer the following questions.
1. Are they the same?
2. Are they different?
3. Which one is larger?

See what I mean? Use the IsNull() function to answer the question "is this value null?".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
htrisakti3
Charter Member
Charter Member
Posts: 36
Joined: Thu Jun 10, 2004 11:22 pm

NullToEmpty

Post by htrisakti3 »

I think you can use this function:
NullToEmpty(inlink.Premium) : NullToEmpty(inlink.RATE)
Post Reply