replacing an empty value in the datastage

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

kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

replacing an empty value in the datastage

Post by kirankota79 »

I have some NULL and empty values in column of file. I want to replace both of the values to some numeric value. I can replace a NULL with a value but i cannot for the empty one. Iam using If then else in datastage. Can anybody help me.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

I am not sure but yu can do something like this:

Code: Select all

If IsNull(link.col) then '16161' elseif len(link.col)=0 then '2332' else link.col
Sam
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

i think this is not a valid sysntax..please give me the correct one
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Play around with this:

Code: Select all

 If (IsNull(link.col) OR len(link.col)=0) then 'XXX' else link.col
In previous post there should be space between else and if.

Sam
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

You could have done a little changes and checked yourself.
Use else if instead of elseif

Code: Select all

If IsNull(link.col) then '16161' else if len(link.col)=0 then '2332' else link.col
Does that work?
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

In the file there is a character that looks like small square, whereever i have this character iam not able to replace with values. Other than that iam able to replace with the following statement.

If DSLink3.SSN = 'NULL' OR len(DSLink3.SSN)= '' then "123-12-0000" else DSLink3.SSN
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Not sure, it could be carriage returns, try replacing it with CHAR(13):CHAR(10) and see if it helps.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

it is not working. I can understand that i have some junk values in the column. I want to get rid of them and replace the junk values with some other value. does anybody has a clue?
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

what is your OS and your source system? As suggested by narasimha, you might have the LF or CR or non-printable characters in the file and you need to get rid of them.

Sam
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

my OS is window 2003 server.
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

source system? i am using a sequential file as an input in which the data is from db2
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

Post by kirankota79 »

sam.....as i have already mentioned the character is see here looks like a small square box. these is no information about these characters in your link.
i appreciate if you give me some clues regarding this.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

What Sam is trying to tell you here is to try open the file and find out if you can decipher these "small squares".
Do you have cygwin or similar tools installed? If yes you can vi the file and easily find out if these characters are carriage returns or not.
I dont know a way to figure this out in windows.
May be some windows expert can comment on this.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Dollars to Doughnuts that 'square' is a DOS End-Of-File marker, a Ctrl-Z. As long as there's only one that is, and it's at the end of the file.

Otherwise, you'll need to take a peek at it with a Hex Editor or viewer of some sort.
-craig

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