numeric value to trimed

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
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

numeric value to trimed

Post by snt_ds »

Hi,

I have a numeric column in the backend.
values for this looks like below :
00000123
00000456
00000789
in datastage I need to trim to look like below:
123
456
789
can some please let me know if there is function.

Thanks
Ram
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 »

Try

Code: Select all

Trim(InCol, '0', 'L')
It certainly works in Server Edition. Not sure about parallel/DSEE.
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
karrisuresh
Participant
Posts: 57
Joined: Sat Jun 09, 2007 1:14 am
Location: chicago

Re: numeric value to trimed

Post by karrisuresh »

Hi In the transformer u can use the string function called ltrim and apply that on this column may solve ur problem
pls ack me


snt_ds wrote:Hi,

I have a numeric column in the backend.
values for this looks like below :
00000123
00000456
00000789
in datastage I need to trim to look like below:
123
456
789
can some please let me know if there is function.

Thanks
Ram
Hi I have experience in parallel extender datastage I am ready to give/take help from other
hope we all help each other hand in hand
karrisuresh
Participant
Posts: 57
Joined: Sat Jun 09, 2007 1:14 am
Location: chicago

Re: numeric value to trimed

Post by karrisuresh »

Hi In the transformer u can use the string function called ltrim and apply that on this column may solve ur problem
pls ack me


snt_ds wrote:Hi,

I have a numeric column in the backend.
values for this looks like below :
00000123
00000456
00000789
in datastage I need to trim to look like below:
123
456
789
can some please let me know if there is function.

Thanks
Ram
Hi I have experience in parallel extender datastage I am ready to give/take help from other
hope we all help each other hand in hand
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What is the data type?

The Data Browser always displays Decimal and Numeric data with leading zeroes, so it may be that the source data do not even have leading zeroes; what you are describing may simply be an artifact of using View Data. And nothing you do except changing the data type to string will affect this.

The leading zeroes are irrelevant, and will load happily into any database target if the column is a numeric data type. If the target is a text file, convert to string (VarChar) and trim the leading zeroes. Do not use Char, as this will be padded with trailing APT_STRING_PADCHAR characters.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Re: numeric value to trimed

Post by I_Server_Whale »

karrisuresh wrote:Hi In the transformer u can use the string function called ltrim and apply that on this column may solve ur problem
pls ack me
I'm using version 7.5x2 and ltrim() was not found in the string functions list. :?

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 »

That's because there's no such intrinsic function. Which is not to say karrisuresh has not written one - if so, why not share it?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Change the target metadata to Integer. That should take care of it.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply