Date Calculations

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
new_ds_man
Participant
Posts: 18
Joined: Tue Jul 08, 2008 1:12 pm

Date Calculations

Post by new_ds_man »

Hi All,

I need some help on some Date calculations.

My Requirement:

I have a month_number assigned to every month starting 'MAY-2009'.

Ex:

Create_Date, Month_Number

May-2009, 150
June-2009, 151
July-2009, 152
........... as so forth


I receive create date from source, which, say is today's date 2009/10/05, i need to calculate the current month number using the start date (May 2009) and Month number (150) that i have.

Help Appreciated.
Thanks in Advance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

This 'month number' reference, where is it stored - in a database table? And the 'create month' is a string field? And are you saying there's more to this than just a lookup, that you have a starting month/number and you need to compute the result somehow? Or just convert '2009/10/05' to 'October-2009' and do a lookup to get 155? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
new_ds_man
Participant
Posts: 18
Joined: Tue Jul 08, 2008 1:12 pm

Post by new_ds_man »

chulett wrote:This 'month number' reference, where is it stored - in a database table? And the 'create month' is a string field? And are you saying there's more to this than just a lookup, that you have a starting month/number and you need to compute the result somehow? Or just convert '2009/10/05' to 'October-2009' and do a lookup to get 155? :?

Hey Chulett,

The month number, it is not stored anywhere. we actually know the number for May 2009 as 150. We will be provided the create date and we need to deduce the month number for the provided date using the available date & number (may 2009, 150).
The calculation needs to be done in DS on the fly.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Okay... what's stopping you from storing it somewhere, even if that somewhere is only a flat file, you could use it to do a lookup against. And a job would build the list one time, rather than having to do it 'on the fly' each time. Just curious...
-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 »

The fact that YOU know it doesn't help DataStage!

It could be a calculation or a lookup.

For example

Code: Select all

InLink.TheYear - 2009 + 155
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
new_ds_man
Participant
Posts: 18
Joined: Tue Jul 08, 2008 1:12 pm

Post by new_ds_man »

Thanks Guys, I am planning on getting this done thru a SQL by looking up the table. I will updated this thread once the issue is resolved.
Post Reply