how to eliminate left & right side zero's

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
ds_dwh
Participant
Posts: 39
Joined: Fri May 14, 2010 6:06 am

how to eliminate left & right side zero's

Post by ds_dwh »

my i/p like this
column
001
102
1300
00102

required o/p like this
column
1
102
13
102

how to achive this one
ANJI
antonyraj.deva
Premium Member
Premium Member
Posts: 138
Joined: Wed Jul 16, 2008 9:51 pm
Location: Kolkata

Post by antonyraj.deva »

TRIML and TRIMT functions in a transformer with "0" specified as the character to be removed.

--Tony
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What are your data types?

Trim() function has options to strip from either or both sides.

Convert() would not be appropriate because it would also take out embedded zeroes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

antonyraj.deva wrote:TRIML and TRIMT functions in a transformer with "0" specified as the character to be removed.

--Tony
These functions do not exist in the 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.
antonyraj.deva
Premium Member
Premium Member
Posts: 138
Joined: Wed Jul 16, 2008 9:51 pm
Location: Kolkata

Post by antonyraj.deva »

ray.wurlod wrote: These functions do not exist in the Transformer stage.
Sorry Ray...was little confused :? :(
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

Re: how to elimenate left & right side zero's

Post by agpt »

ds_dwh wrote:my i/p like this
column
001
102
1300
00102

required o/p like this
column
1
102
13
102

how to achive this one
make two stage variables

first would remove leading zeros and second trailing:

stage1 = trim(input,"0","L")
stage2 = trim(stage1,"0","R")

Here stage 2 is going to be your output variable.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Re: how to elimenate left & right side zero's

Post by priyadarshikunal »

agpt wrote: make two stage variables

first would remove leading zeros and second trailing:

stage1 = trim(input,"0","L")
stage2 = trim(stage1,"0","R")

Here stage 2 is going to be your output variable.
You don't need 2 fuctions to do that, just use trim with option 'B'.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

Re: how to elimenate left & right side zero's

Post by agpt »

priyadarshikunal wrote:
agpt wrote: make two stage variables

first would remove leading zeros and second trailing:

stage1 = trim(input,"0","L")
stage2 = trim(stage1,"0","R")

Here stage 2 is going to be your output variable.
You don't need 2 fuctions to do that, just use trim with option 'B'.
true :) thanks Priya.....
Post Reply