Page 1 of 1

To trim leading zero's in a sequential file

Posted: Thu Aug 11, 2011 2:44 am
by poorna.ds
Hi All,
My job design is
ORACLE ENTERPRISE------->TRANSFORMER--------->SEQ FILE

Sequential file has 6 columns. Represented all columns as Varchar(11,2)
First two columns are string values,while rest 4 columns contain amount value. When i load the data in seq file, i need data in format for last 4 columns as eg : 2.17, 666.6, 39901.45, 2890716
But the data in o/p I get is something like below:
00000002.17, 000000666.6, 00039901.45, 000000289

My req is that i need data with trimed leading zero's.
Can anybody suggest me on this?

To trim leading zero's in a sequential file

Posted: Thu Aug 11, 2011 3:46 am
by ulab
go to file properties in the target file and set the column/field properties and its values

Re: To trim leading zero's in a sequential file

Posted: Thu Aug 11, 2011 4:20 am
by poorna.ds
ulab,
I guess what u are saying is the basic thing that we have to do before loading the data. But the thing is the amount column length varies. So length is mentioned as Varchar(11,2) which i have already mentioned.

Posted: Thu Aug 11, 2011 6:28 am
by chulett
There's no such thing as Varchar(11,2). Strings don't have a scale. :?

If you need to trim something, it would make sense to use the trim() function for that, yes? It defaults to space but you can override that and you can also override the default behaviour of "all".

string remove zeros

Posted: Thu Aug 11, 2011 6:45 am
by rameshv
In String how to define precision and scale.String property have precision only,You can use ltrim (input column).

Posted: Thu Aug 11, 2011 7:19 am
by poorna.ds
chullet: 'There's no such thing as Varchar(11,2). Strings don't have a scale.'

Here i meant to say that the metadata defined in the seq file is like :
Columnname SQLtype Length Scale
col1 varchar 11 2

I guess i should have explained it like this instead of Varchar(11,2)

Can I use trim function in sequential file?

Posted: Thu Aug 11, 2011 7:23 am
by jwiles
You don't specify a scale for a string datatype because there is no scale, as Craig as indicated. Only when you convert it to a numeric datatype (number, decimal, float?) can you specific a scale. While it's still in a string datatype it's just a collection of character data.

Use the trim() function mentioned earlier with the appropriate option to remove leading characters, as documented in the Parallel Job Developer's Guide or on <a href=http://publib.boulder.ibm.com/infocente ... 22%20>this page</a>

Regards,

Posted: Thu Aug 11, 2011 11:38 pm
by nbalegar
Use this function it will remove the leading zeros from the column TRIM(col1,'0',L)

Re: To trim leading zero's in a sequential file

Posted: Fri Aug 12, 2011 12:03 am
by SURA
Use CAST in SQL Query level

DS User

Posted: Mon Aug 15, 2011 9:36 am
by samsuf2002
If you are expecting decimal values then your source should be either decimal or numberic with given scale, then while loading into file you can convert decimal to string and trim it and also your target should be a string like varchar.

Posted: Mon Aug 15, 2011 9:56 am
by vinothkumar
Try this
DecimalToString(ColunmName, "suppress_zero")