In a given number if the fourth digit is 0 i wanto remove th

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vijaydev
Participant
Posts: 54
Joined: Sun May 20, 2007 6:31 pm

In a given number if the fourth digit is 0 i wanto remove th

Post by vijaydev »

I want to remove the 0 if it is 4th byte from the given number.

Eg

123045678 -- i need 12345678
9870124 -- i need 987124
80124578 -- i need 80124578

Pls. help, Thanks in Advance

Vijay
Vijay
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

You can try something like this :

Code: Select all

if In.string[4,1] = 0 then In.string[4,1] = '' Else In.string
or
if In.string[4,1] = 0 then In.string[1,3]:In.string[5,Len(In.string)] Else In.string

Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
vijaydev
Participant
Posts: 54
Joined: Sun May 20, 2007 6:31 pm

Post by vijaydev »

Thank you Joshy George

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

Post by ray.wurlod »

The first suggestion won't work, because you can't have an assignment statement in an expression. (In.string[4,1] = '') will be treated as a comparison expression and always return 0 (for False).

The second suggestion is a good one.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Rightly said, only the second one will work

Code: Select all

if In.string[4,1] = 0 then In.string[1,3]:In.string[5,Len(In.string)] Else In.string

Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Post Reply