Convert value to Years

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
halpavan2
Participant
Posts: 31
Joined: Fri Apr 18, 2008 5:44 am
Location: Hyderabad

Convert value to Years

Post 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
pavan
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What value? What unit of measurement?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
halpavan2
Participant
Posts: 31
Joined: Fri Apr 18, 2008 5:44 am
Location: Hyderabad

Post by halpavan2 »

i am getting the value from source(Integer) like this

194
2037
20438
32599

want to convert this to years
pavan
manoj_23sakthi
Participant
Posts: 47
Joined: Tue Feb 23, 2010 12:16 am
Location: CHENNAI

Post 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
halpavan2
Participant
Posts: 31
Joined: Fri Apr 18, 2008 5:44 am
Location: Hyderabad

Post 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...
pavan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need to decide where to round a fractional year up or down and then adjust the code accordingly.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply