Regarding number of months

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

Regarding number of months

Post by veera24 »

hi all,
Am having two i/p columns which consists of date field. Am in need to take the difference between these two columns and i got to change into number of months. Is there any function to implement the same? Or shall i take the difference between the two by using iconv function and then divide it by 30?


Your time will be highly appreciated.

Thanks in advance
veera...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The second approach would not be accurate. On the other hand, there's nothing out of the box that satisfies the requirement. Therefore I recommend that you create a routine that decomposes the dates into year, month and day components and performs the correct arithmetic.

That way you can satisfy your business rule about the result - do you need completed months, a figure rounded to the nearest number of months, fractional months are permitted...

Take some time to design test data for the routine. For each pair of dates determine the expected result and compare this against actual.
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