DEFAULT VALUE IN COLUMN FIELD

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
pradkumar
Charter Member
Charter Member
Posts: 393
Joined: Wed Oct 18, 2006 1:09 pm

DEFAULT VALUE IN COLUMN FIELD

Post by pradkumar »

I am trying to do the follow

if isnull(in.col2) then (in.col1) else enter default value of col2

I defined the default value of col2 as default which is NA

but when i ran the job it is not entering the default value
Pradeep Kumar
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Re: DEFAULT VALUE IN COLUMN FIELD

Post by dsscholar »

Please post the exact transformation that you are doing, it cant be

if isnull(in.col2) then (in.col1) else enter default value of col2

I would suggest the following code,
if isnull(in.col2) then (in.col1) else 'NA'

However this doesn't look logically correct to me.

It should be something like
if isnull(in.col2) then 'NA' else in.col2
This will replace nulls with NA for col2

Please let me know if I have not understood you correctly
pradkumar
Charter Member
Charter Member
Posts: 393
Joined: Wed Oct 18, 2006 1:09 pm

Post by pradkumar »

My requirement is osmething different.
There are certain columns which when null should have the value of the colno-1..If the col(x) is null then i am entering NA then if col(x+1) is also null, it should be NA.

Hope I am clear now
Pradeep Kumar
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

pradkumar wrote:My requirement is osmething different.
There are certain columns which when null should have the value of the colno-1..If the col(x) is null then i am entering NA then if col(x+1) is also null, it should be NA.

Hope I am clear now
For the above mentioned requirement, the transformation should be

If Not(IsNull(in.col2)) then (in.col2) Else (If IsNull(in.col1) then 'NA' else in.col1)

Hope this helps !
pradkumar
Charter Member
Charter Member
Posts: 393
Joined: Wed Oct 18, 2006 1:09 pm

Post by pradkumar »

Thanks
Pradeep Kumar
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

pradkumar wrote:Thanks
Did it work ?? :?:
Post Reply