To supress Zero in decimal colm

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

Suganya Vanjinathan
Participant
Posts: 12
Joined: Tue Aug 26, 2008 11:05 pm
Contact:

To supress Zero in decimal colm

Post by Suganya Vanjinathan »

Hi ,


From source(teradata) I am extracting a decimal coln with datatype decimal(6) and putting it in to a text file with datatype(decimal(6)).My problem is ,for source value 500 i am getting output as [b]000500.[/b] (with the period). I dont know how to supress this zero and period. :( . if any body know how to resolve it.
Regards,
Kithu
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Search for decimalToString
Suganya Vanjinathan
Participant
Posts: 12
Joined: Tue Aug 26, 2008 11:05 pm
Contact:

Post by Suganya Vanjinathan »

Supressed Zero as u said . But my target is Decimal. while inserting again i convert it in to string to decimal. still it is showing the same result.
Regards,
Kithu
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

Does it matters if you are writing varchar(6) or Integer to the sequential file instead of decimal(6)?
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Suganya Vanjinathan
Participant
Posts: 12
Joined: Tue Aug 26, 2008 11:05 pm
Contact:

Post by Suganya Vanjinathan »

Yes. Our client need it in that format :(
Regards,
Kithu
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Is it fixed width or delimited output?
Suganya Vanjinathan
Participant
Posts: 12
Joined: Tue Aug 26, 2008 11:05 pm
Contact:

Post by Suganya Vanjinathan »

Delimited with ,
Regards,
Kithu
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Then call it Varchar(6)
Suganya Vanjinathan
Participant
Posts: 12
Joined: Tue Aug 26, 2008 11:05 pm
Contact:

Post by Suganya Vanjinathan »

In client side they are loading it in to some other database.There it is like decimal (6). will it wont give problem if it varchar in file.
Regards,
Kithu
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

I dont think it will make any difference since your source is a decimal .Also , there is an option called supress zero in the conversion function you can try with it and let us know if its working or not
Nag
Suganya Vanjinathan
Participant
Posts: 12
Joined: Tue Aug 26, 2008 11:05 pm
Contact:

Post by Suganya Vanjinathan »

I used That supress Zero option . It is working fine if the target is varchar.But my target coln is decimal(6)
Regards,
Kithu
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Why don't you give it a try by making your output as Varchar(6) ?
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

The decimal field will always have zero padded in front of the actual value to make it to defined length. You can't do anything with that. Changing it to VarChar(6) will not impact the other jobs reading this field as decimal(6) as the sequential file doesn't store the metadata and the value present in that field id numeric.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Exactly. You are trying to 'solve' a non-existent problem.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Suganya Vanjinathan
Participant
Posts: 12
Joined: Tue Aug 26, 2008 11:05 pm
Contact:

Post by Suganya Vanjinathan »

Thanks a lot every body
Regards,
Kithu
Post Reply