Posted: Thu Feb 07, 2008 11:15 am Post subject: Date Logic
Hi,
Please help me in the following requirement.
The requirement is take system date, and add 6 days to that date.
If it rolls over to next month, then add 2 to the system month otherwise add 1 to the system month. I need this to be done in SORT
For ex:
If the system run date is 12/25/2007.
The out put date would be : 01/25/2008. Because the date is 12/31/2007 after adding 6 days.
If the system run date is 12/26/2007.
The out put date would be : 02/25/2008. Because the date rolls over to next month.
For today's date (02/07/2008), SORTOUT would have:
03/07/2008
For 12/25/2007, SORTOUT would have
01/25/2008
For 12/26/2007, SORTOUT would have
02/26/2008 _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Yes, it should be 02/26/2008. Thanks for your help.
I also tried with the follwoing code and got the result. Please let me know if you see any problem.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Feb 07, 2008 3:30 pm Post subject:
Your job doesn't appear to give you the output you said you wanted. For example, for 12/25/2007 you said you wanted 01/25/2008. That's what my job gives you. But it appears your job gives you 2007/01/31. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu Feb 07, 2008 3:57 pm Post subject:
SK2007,
Also be aware of getting an invalid date if it is a leap year. For ex : if you are running the job on Jan 24 of 2008 and you add 6 days to it , it is Jan 30th and now you add 1 month to it which makes it feb 30th 2008 which is an invalid date. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Oct 25, 2010 5:25 pm Post subject:
SK2007,
With PTF UK90025 for z/OS DFSORT V1R10 and PTF UK90026 for z/OS DFSORT V1R12(Oct, 2010), DFSORT now supports date arithmetic which can add/subtract days, months or years to a given date like shown below.
For complete details of date arithmetic functions and other new functions see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) at:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum