kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue May 03, 2011 10:32 am Post subject: |
|
|
Nagavenkata M Purilla,
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 be used to calculate the number of days difference between two dates. The result is an 8-byte value consisting of a sign and 7 digits (sddddddd). If the first date is greater than or equal to the second date, the sign is + (plus). If the first date is less than the second date, the sign is - (minus).
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAA 01/13/2012
BBBBBBBB 02/13/2013
CCCCCCCC 03/13/2014
DDDDDDDD 04/13/2015
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,OVERLAY=(81:DATE1,11,10,UFF,M10,LENGTH=8)),
IFTHEN=(WHEN=INIT,OVERLAY=(25:89,8,Y4W,DATEDIFF,81,8,Y4T))
//* |
The output from the above job is
Code: |
AAAAAAAA 01/13/2012 +0000255
BBBBBBBB 02/13/2013 +0000652
CCCCCCCC 03/13/2014 +0001045
DDDDDDDD 04/13/2015 +0001441
|
For complete details of date arithmetic functions and other new functions see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) at:
http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
Easytrieve has a Macro called "datediff" which will give you the difference between 2 dates. However they are add-on macros. _________________ Kolusu
www.linkedin.com/in/kolusu |
|