I want to get first day of previous month date (YYYYMMDD) and last day of previous month date(YYYYMMDD) in datastage job..Please advise me how to get it done in tranformer
Example ..If i run my job today i want 20080701 as first date and 20080731 as last date of previous month
Thanks in advance
First & Last Day of Last Month
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 21
- Joined: Wed Aug 27, 2003 5:12 pm
- Location: Chile -South America
- Contact:
Hi,
In DataStage exists a transform called MONTH.FIRST, it explanation is
"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"
Then you can rest 1 from the result and use oconv to obtain tha last day of the previous month --> LastDay=oconv(result,"D-YMD[4,2,2]")
Now you juas need to repeat MONTH.FIRST with the new result
FirstDay=MONTH.FIRST(LastDay[1,7])
Very clear uh?
In DataStage exists a transform called MONTH.FIRST, it explanation is
"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"
Then you can rest 1 from the result and use oconv to obtain tha last day of the previous month --> LastDay=oconv(result,"D-YMD[4,2,2]")
Now you juas need to repeat MONTH.FIRST with the new result
FirstDay=MONTH.FIRST(LastDay[1,7])
Very clear uh?
-
- 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: