decimal field problem

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
shihaj
Participant
Posts: 3
Joined: Thu Aug 10, 2006 1:18 am
Location: Bangalore

decimal field problem

Post by shihaj »

i have a decimal field in a file, to which data is loaded as 00000.0, instead of 0.0, for an input 000000. Even after i do a trimming on 0s, the problem is not solved.


Intially the input is char and i am converting it to decimal using string to decimal and i get this - 00000.0 (for 5,1) and again loading into a char field in the xml, which is loaded as 00000.0.

can anyone tell me how to remove the leading zeros from this?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Welcome Aboard
It is doing what you asked it to do. Converting it to Decimal(5,1). What is the datatype of this particular column, as defined in your output link. What is your output , is it a flat file or database?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
vij
Participant
Posts: 131
Joined: Fri Nov 17, 2006 12:43 am

Post by vij »

DSguru2B wrote:Welcome Aboard
It is doing what you asked it to do. Converting it to Decimal(5,1). What is the datatype of this particular column, as defined in your output link. What is your output , is it a flat file or database?
thanks for ur reply.

this is wat has to be achieved:

A column (string 6) wth value for eg., 000000 from a dataset needs to be loaded into xml with decimal (5,1), as using a decimal in xml didnt give favorable output, it was being used as a char of lenght 10 and we faced the abbove said problem...

pls help in solving the problem
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

vij wrote:
thanks for ur reply.

this is wat has to be achieved:

A column (string 6) wth value for eg., 000000 from a dataset needs to be loaded into xml with decimal (5,1), as using a decimal in xml didnt give favorable output, it was being used as a char of lenght 10 and we faced the abbove said problem...

pls help in solving the problem
ur, wat, lenght,abbove and pls do NOT belong to the english language. And hence makes it difficult to understand your posts. Can you please correct/edit your post?

There is always the 'preview' button to check for misspells or typos or format issues. Use it. :)

Thanks,
Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Search would have revealed to you that Decimal data are always displayed with leading an trailing non-significant zeroes, so that you can be sure that precision and scale are working correctly, and so that they can correctly populate fixed-width format files. Such decimal values can correctly be loaded into database tables.

So why do you want to remove the leading zeroes? It's not necessary.

If you want to persist, convert to VarChar() and trim from there. You can do this with a Modify stage or with a Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply