Hi,
Is there a function in datastage server which can add months,something similar to ADD_Months function in Oracle.
I need to increment months based on an index ...
Can anyone help me out on this...
How to Add Months In DataStage
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 112
- Joined: Mon Jul 11, 2005 7:54 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
There is no out of the box function. It is easy enough to write one.
- Add Int(Months/12) to the years.
Add Mod(Months,12) to the months.
Adjust if the new months figure is greater than 12.
Adjust by subtracting days if the number of days in the new month is illegal.
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: 112
- Joined: Mon Jul 11, 2005 7:54 am
Hi,ray.wurlod wrote: There is no out of the box function. It is easy enough to write one.
- Add Int(Months/12) to the years.
Add Mod(Months,12) ...
Thnx ray... But What i want to know is , assume i have a running counter and i need to increase my month by adding the counter to it.
i.e. month= 03 and counter = 01 for 1st run
Therefore : when x = month + counter = 03 +1 = 04.
run 2 : month = 03 counter = 02
when x = month + counter = 03 +2 = 05.
Is there any function which could add months based on a counter...
Why don't you create c routine to do it. The time sructure will allow you to do everything about manipulating the date.
Pneuma Lin.
pneumalin@yahoo.com
pneumalin@yahoo.com
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you've already got months and counter, then assuming months + counter can never be less than 1 or more than 24. All data types are uint8 or a larger or signed integer.
Code: Select all
If (months + counter > 12) Then months + counter - 12 Else months + counter
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.