getting data for the last three months
Moderators: chulett, rschirm, roy
getting data for the last three months
I have the following requirement. I need to extract data for the last three months. So today (18-06-2013) I have to extract data from 01-03-2013 to 31-05-2013.
I managed to get the enddate : OConv((MONTH.FIRST(MONTH.TAG(DATE()))) ,'D-YMD[4,2,2]') :' ':Oconv(Time(),'MTS.') gives me "2013-06-01 11:13:17.000". My first question is how to transform this to "2013-06-01 00:00:00.000".
My second question is : how do I go three months back ?
I managed to get the enddate : OConv((MONTH.FIRST(MONTH.TAG(DATE()))) ,'D-YMD[4,2,2]') :' ':Oconv(Time(),'MTS.') gives me "2013-06-01 11:13:17.000". My first question is how to transform this to "2013-06-01 00:00:00.000".
My second question is : how do I go three months back ?
OConv((MONTH.FIRST(MONTH.TAG(DATE()))) ,'D-YMD[4,2,2]') :' 00:00:00'
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
How do you define '3 months back'?
does it mean subtract 90 days? or the first day of the month when you subtract 3 from the current month? Or some other rule?
does it mean subtract 90 days? or the first day of the month when you subtract 3 from the current month? Or some other rule?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
One last question - you are using OCONV() so I would assume a server job, but the question is posted in the parallel forum. The answer depends upon which you are really using.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I suspect the question relates to a sequence governing parallel jobs.
You might like also to investigate using DataStage routines such as the AddMonths routine available here.
You might like also to investigate using DataStage routines such as the AddMonths routine available here.
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.
getting data for the last three months
Hi uzl,
You may use the following to get the 3 month back date-
You may use the following to get the 3 month back date-
Code: Select all
'01':"-":(if DSJobStartTimestamp[6,2] - 3 <10 Then 0:DSJobStartTimestamp[6,2] - 3 Else DSJobStartTimestamp[6,2] - 3):"-":DSJobStartTimestamp[1,4]:'00:00:00'
Re: getting data for the last three months
Thanks bhasds. We use different date-formats but your example has set me in the right direction.
=> the derivation of the year works only for years > 2000
Code: Select all
prepBeginMaand_uv.UV_beginMaand : if DSJobStartTimestamp[6,2]-3 <= 0 then (DSJobStartTimestamp[6,2] + 9) else ('0' : DSJobStartTimestamp[6,2]-3)
prepBeginMaand_uv.UV_beginJaar : if DSJobStartTimestamp[6,2]-3 <= 0 then (DSJobStartTimestamp[1,4] - 1) else DSJobStartTimestamp[1,4]
dateBegin_UV : prepBeginMaand_uv.UV_beginJaar : '-' : prepBeginMaand_uv.UV_beginMaand : '-01 00:00:00.000'
-
- 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: