Drop last character in astring

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
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Drop last character in astring

Post by vinaymanchinila »

Hi,
I have a source col and I need to drop the last character off it , here is what I tried to do


Stage Variable: Len1=Len(Src.Col1)

Output=Src.col1[1,Len1]

Apparently I cannot use the Stage variable , is there any other way I can do it.

Src=abcdef
Required Tgt=abcde

The source length is varying and not fixed.

Thanks
Thanks,
Vinay
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Code: Select all

LEFT(in.col, (LEN(in.col)-1)
And with your code, you need to provide LEN(in.col) - 1 for stage variable LEN1. It will work
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Thanks it works
Thanks,
Vinay
Post Reply