Calculate BIRTH DATE from AGE

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
naveed.zuber
Participant
Posts: 19
Joined: Wed Jul 16, 2014 4:14 am

Calculate BIRTH DATE from AGE

Post by naveed.zuber »

Please help with below requirement-

Transformer stage below field needs to derive-

BIRTH DATE=CurrentDate() - AGE

Ex:AGE is 38.
BIRTH DATE is DATE field.
atulgoel
Participant
Posts: 84
Joined: Tue Feb 03, 2009 1:09 am
Location: Bangalore, India

Post by atulgoel »

Try Below function in transformer in Datastage 8.5 version:

DateOffsetByComponents(%basedate%,%yearoffset%,%monthoffset%,%dayoffset%)

DateOffsetByComponents(CurrentDate(),-38,0,0)
Atul
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How can you derive a birthdate from an AGE? Every day the 'birthday' will change. Birth year, perhaps. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Resist stupid requirements!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
stuartjvnorton
Participant
Posts: 527
Joined: Thu Apr 19, 2007 1:25 am
Location: Melbourne

Post by stuartjvnorton »

ray.wurlod wrote:Resist stupid requirements! ...
Should be a t-shirt.

Whoever came up with this requirement needs to be... um... reminded... that you can't invent detail.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Favourite t-shirt ever:

Code: Select all

 ===>
CLOWNS

 <===
JOKERS
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
U
Participant
Posts: 230
Joined: Tue Apr 17, 2007 8:23 pm
Location: Singapore

Post by U »

Date of birth can be calculated from AGE, if and only if AGE is given in days and time of birth is known.
naveed.zuber
Participant
Posts: 19
Joined: Wed Jul 16, 2014 4:14 am

Post by naveed.zuber »

Yes this is stupid requirement from Customer.
Thanks Atul for your help.

Below transformation function working for me.
DateOffsetByComponents(%basedate%,%yearoffset%,%monthoffset%,%dayoffset%)

DateOffsetByComponents(CurrentDate(),-1*INPUTFIELD,0,0)
Post Reply