Trim functionality failure

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
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Trim functionality failure

Post by Aquilis »

Hi all,
I have the Decimal(38,10) data an i am loading it to the another DB table as a Vatchar2(25). when i run the job data gets loaded with the added leading zeros.

If data is '6.50',then......'000000000000000000000006'(23zeros)
For 57.98............'0000000000000000000000057'(22 zeros)

if data is a absolute value say '6'...then it will get loaded as '000000000000000000000000'(24 zeros) ..No data at all.

i tried with the trim function:

Trim(column_name,"0","L")....it doen't work.
Trim(column_name,"0","T")....it doen't work.
Trim(column_name,"0","B")....it doen't work

Trim(column_name,"0","A")....work well
Trim(column_name,"0","R")....work well

how could is this possible,some functions work well and some wont work at all.
I tried with funtions like:
Decimaltostring(Column_name,Fixzero)
Decimaltostring(Column_name,suppress_zero)
Decimaltostring(Column_name,Fixzero,suppress_zero)

i searched the forum about leading zeros but didn't find the suitable solution thats why opened a new thread.
Aquilis
stefanfrost1
Premium Member
Premium Member
Posts: 99
Joined: Mon Sep 03, 2007 7:49 am
Location: Stockholm, Sweden

Post by stefanfrost1 »

should work with decimaltostring and the supress_zero command, but you need to put in in quotes as in the example given by datastage... Furthermore if you use trim you need to convert the decimal to string first. so if the zeros are not remove when using decimaltostring the shhould be removed by trim if you do it on the result of the decimaltostring operation
-------------------------------------
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post by Aquilis »

stefan,
I worked out.According to your suggestion i have tranformed decimal to string then applied trim,it worked out.
I used function as:
Trim(Decimaltostring(Column_name,Fixzero,suppress_zero),"0","L")..

But one thing i didn't get that below functions works well even when we don't use decimalTostring function.
Trim(column_name,"0","A")....work well
Trim(column_name,"0","R")....work well

if you have any ideas,please share.

Thanks.
Aquilis
Post Reply