Trim not working in else clause

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
pillip
Premium Member
Premium Member
Posts: 50
Joined: Thu Dec 10, 2009 10:43 am

Trim not working in else clause

Post by pillip »

Hi,

Below is what I am implemented in datastage

COALESCE(trim(field),'-1')

I am using If clause where I check for empty string and put -1 else trim the field.

If I use TrimLeadingTrailing(NulltoValue(field,-1)) I am getting an error while compilation saying that a composite call is not allowed.

Hence i am using If then else clause as below :

If TrimLeadingTraling(field)='' then -1 else TrimLeadingTrailing(field) ---

the issue with the above is that the part in the else clause is not functioning. The -1 is getting populated fine for a null but the trim part is not happening for not null fields. I have tried putting in stage variables and also used stripwhitespace and trim instead of Trimleadingtrailing. None is working.

Please advice.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Break it up into a couple of stage variables. NullToValue() into one, then TrimLeadingTrailing() applied to the first into the next.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pillip
Premium Member
Premium Member
Posts: 50
Joined: Thu Dec 10, 2009 10:43 am

Post by pillip »

Thanks Ray. Actually there is a Change data capture stage after the transformer stage, the link ordering was incorrect in that because of that I was facing the trim issue. This issue got resolved, but a new issue came up.

Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Technically, this post should be closed as Resolved and a new one opened for your unrelated issue...
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Thanks for that.
-craig

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