Transalate Total Months to number of Yrs and months

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
janreddy
Participant
Posts: 15
Joined: Tue Apr 07, 2009 9:57 am

Transalate Total Months to number of Yrs and months

Post by janreddy »

Hi,
I have the source column: Total_Life in Months and I would like to translate to Number of Years field and Remaining Months field.

Ex: Total_Life = 40 Months
Number of Years= 40/12=3.34 out of this I want only 3 (yrs)
Remaining Months=.34*12=4 Months approximately.

Basically I need to avoid decimals while getting year part and I need to consider the value after decimals for Months.

Could you help me with what function we may use in Datastage.

Thanks
Jana
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do a Mod() of the total number of months by 12 to get any remaining months in the last partial year. And Floor() should work for the years part, I would think.
-craig

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