Hi
Can any one help me with this scenario.
I have current date, If current date falls in between
yyyy-mm-02,
!
!
!yyyy-mm-05 of month then get the last date of previous month.
for ex:current date =2013-07-02 then i need to populate as 2013-06-30
simillarly if date falls as 2013-07-03 then also its 2013-06-30
Thanks
Implementing date logic
Moderators: chulett, rschirm, roy
Re: Implementing date logic
This can be done using different ways.
I would prefer to get the value from DB itself.
If your source is DB, then you can bring an additional column called First Date Of the month with value. Then that date can be compared in Datastage.
I would prefer to get the value from DB itself.
If your source is DB, then you can bring an additional column called First Date Of the month with value. Then that date can be compared in Datastage.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Hi Raji,
In DataStage we have a Transform called MONTH.FIRST.
This Transform Returns a numeric internal date corresponding to the first day of a month given in MONTH.TAG format (YYYY-MM).
Example: MONTH.FIRST("1993-02") => 9164".
For your logic Fetch "YYYY-MM" from your input column and use this transform. Once you get the Numeric internal date from that subtract 1 from the value.
Example: MONTH.FIRST("1993-02") => 9164" , this is the 1st Day of the month,to get the last month last date just do "9164-1" which gives 9163.
The convert the result using oconv(result,"D-YMD[4,2,2]").
Now just compare the dates in and pass the above value once the condition is satisfied.
Hopes this answers your solution.![Smile :)](./images/smilies/icon_smile.gif)
In DataStage we have a Transform called MONTH.FIRST.
This Transform Returns a numeric internal date corresponding to the first day of a month given in MONTH.TAG format (YYYY-MM).
Example: MONTH.FIRST("1993-02") => 9164".
For your logic Fetch "YYYY-MM" from your input column and use this transform. Once you get the Numeric internal date from that subtract 1 from the value.
Example: MONTH.FIRST("1993-02") => 9164" , this is the 1st Day of the month,to get the last month last date just do "9164-1" which gives 9163.
The convert the result using oconv(result,"D-YMD[4,2,2]").
Now just compare the dates in and pass the above value once the condition is satisfied.
Hopes this answers your solution.
![Smile :)](./images/smilies/icon_smile.gif)
Mohsin Khan
Datastage Consultant
Datastage Consultant
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
In parallel Transformer stage, use MonthDayFromDate() to determine the day number for your range check. Use DateFromDaysSince() and that value to calculate the date of the first day of the current month or the last day of the previous month.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
Check this post for a starter. apart for this you need to add logic to find if the data is between the range you want.
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.![Wink :wink:](./images/smilies/icon_wink.gif)
Genius may have its limitations, but stupidity is not thus handicapped.
![Wink :wink:](./images/smilies/icon_wink.gif)
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You might also consult the FAQ post on Common Date Offsets in Parallel Jobs
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.