Need Logic...

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
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Need Logic...

Post by praburaj »

Hi,
I have one date column in my source table. The date i need to calculate based on four quarter months basis. Means 1st quarter - Jan to Mar 2nd Quart-Apr to Jun 3rd Quart-July to Sep 4th Quart-Oct to Dec.

If my source date comes between first quarter like this Ex: 3/14/2005 then my First Date should be 1/1/2005 and End Date Should be 12/31/2005 and if my source date comes between 2nd quarter like 4/2/2006, then my First Date should be 4/1/2006 and End Date Should be 3/31/2007.

Show me a right direction how to achieve this.
prabakaran.v
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

You can use the substring or left function and fetch the first character of your date field. Then based on that, you can default the date to the required date.

For eg:
a. if your input date is '3/14/2005', then your substr or left function will give the reply as '3', then you can default the date with 1/1/2005.

b. Once your month & date part is done, you can append the year depending on the input date value using right, substr, year functions

This is just a logic to go around... you might have to do some trial & error with the logic.

Regards,
Divya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Int((MonthFromDate(InLink.TheDate)-1)/3)+1
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply