Page 1 of 1

Convert value to Years

Posted: Fri Dec 09, 2011 5:09 am
by halpavan2
Hello All,

I want to convert the value to years by using (365.25 days = 1 year).

Can any one help me how this can be done in datastage parallel jobs.

Thanks
Pavan

Posted: Fri Dec 09, 2011 5:19 am
by ray.wurlod
What value? What unit of measurement?

Posted: Fri Dec 09, 2011 5:34 am
by halpavan2
i am getting the value from source(Integer) like this

194
2037
20438
32599

want to convert this to years

Posted: Fri Dec 09, 2011 6:05 am
by manoj_23sakthi
Hi ,
By using transformer u can get this ..
But i need more clarification on this .

JOB:
Source ---->Trans------->Target

source:
---------
column1
194
2037
20438
32599

Transformer:
--------------
Stage variable: column1/365.25
Column1 : If floor(Stage variable) < 1 then 1 else floor(Stage variable)

Target:
u can get that..

let me know if its Wrong

Thanks
Manoj

Posted: Fri Dec 09, 2011 7:23 am
by halpavan2
Thanks for your reply....

in my source link data is coming form days say from (0-1000)...i want this to converted this to years by using by using (365.25 days = 1 year).

I have tried with above example with 10 records from 1 to 10...anf all the records giving me as 1.

My doubt here was how 1 day will be giving as 1 year afetr using the above logic...

Posted: Fri Dec 09, 2011 7:27 am
by chulett
You need to decide where to round a fractional year up or down and then adjust the code accordingly.