Page 1 of 1
Disappeared the zero infront
Posted: Sat Aug 26, 2006 1:35 am
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
Posted: Sat Aug 26, 2006 1:50 am
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.
Posted: Sat Aug 26, 2006 1:59 am
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!
Posted: Sat Aug 26, 2006 2:39 am
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
Posted: Sat Aug 26, 2006 4:14 am
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.
Posted: Sat Aug 26, 2006 4:14 am
by ray.wurlod
For less than $1 per week you CAN see the premium posts.