Disappeared the zero infront

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
chowmunyee
Participant
Posts: 32
Joined: Wed Dec 28, 2005 9:02 pm

Disappeared the zero infront

Post by chowmunyee »

Hi all,

i have a list of data which is look like that -> 07:30 ,12:30,09:30
what i have to do is i have to extract the data from 07:30 -> 07 , 12:30 ->
12, 09:30 ->09
I used the Oconv(data field name , "G:1") then i can get the 07,12,09

But i dunno how to make it from 07 -> 7 ,12 ->12 , 09 ->9
is there anyway to disappear the zero infront when the data have a zero infront?

please help
thank you
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Performing any arithmetic operation in a DataStage BASIC expression, such as adding zero to the number, will strip non-significant leading and trailing zeroes.

You might also investigate the Field() function, which is slightly more efficient that the group conversion you have chosen to do.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chowmunyee
Participant
Posts: 32
Joined: Wed Dec 28, 2005 9:02 pm

Post by chowmunyee »

ray.wurlod wrote:
Performing any arithmetic operation in a DataStage BASIC expression, such as adding zero to the number, will strip non-significant l ...
Hi,

Eventhough i cant see half of ur explaination....i forgot the trim function.
I'm now using the trim(xxx,0,'L') but still thinking of the field data which is 0:00 -> i have to maintain the 0 to them if the data is 0:00......


anyway thank a lot!
chowmunyee
Participant
Posts: 32
Joined: Wed Dec 28, 2005 9:02 pm

Post by chowmunyee »

chowmunyee wrote:
ray.wurlod wrote:
Performing any arithmetic operation in a DataStage BASIC expression, such as adding zero to the number, will strip non-significant l ...
Hi,

Eventhough i cant see half of ur explaination....i forgot the trim function.
I'm now using the trim(xxx,0,'L') but still thinking of the field data which is 0:00 -> i have to maintain the 0 to them if the data is 0:00......


anyway thank a lot!

I have think of the idea to solve is using if else statement. I'm not sure this is the best or worst but at least i can able to achieved the expected result. Please share with me if you have the better solution than mine one... :)

I'm using
if trim(oconv(xxx, G:1),0,'L')=\\
Then '0'
Else trim(oconv(xxx, G:1),0,'L')

Thank you
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

As Ray has already stated, just add a 0 to the number in a derivation and your leading zeroes will be stripped out.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

For less than $1 per week you CAN see the premium posts.
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