to trim 1th char

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
sathishmca
Participant
Posts: 43
Joined: Mon Mar 03, 2008 10:58 pm
Location: Chennai

to trim 1th char

Post by sathishmca »

Hi to all,

I have a data with 7 characters.i need to remove 1st character if it is 0.

Ex:

0123456 ---> 123456
0012345 ---> 012345

Could you please suggest me some tips?
Sathish Bhojan
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

If Left(InLink.TheString,1) = "0" Then Right(InLink.TheString,6) Else InLink.TheString
What is to happen if the first character is non-zero? You did not include this in your specification.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sathishmca
Participant
Posts: 43
Joined: Mon Mar 03, 2008 10:58 pm
Location: Chennai

Thanks

Post by sathishmca »

ray.wurlod wrote:

Code: Select all

If Left(InLink.TheString,1) = "0" Then Right(InLink.TheString,6) Else InLink.TheString
What is to happen if the first character is non-zero? You did not includ ...
Thaks ray.wurlod..What you have written is correct.If its non zero means can move same as the source.
Sathish Bhojan
sathishmca
Participant
Posts: 43
Joined: Mon Mar 03, 2008 10:58 pm
Location: Chennai

Re: Thanks

Post by sathishmca »

Hi ray,

Any other functions to achive this quit easier than what u gave before?
Sathish Bhojan
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not from me.

You want to write your own function then go ahead, it will encapsulate the expression logic I gave.

Whether or not U has any other ideas remains to be seen: U does not log in all that often.
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