Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Frank Silven,
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.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20101031
20101101
20101102
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(15:1,8,Y4T,ADDDAYS,+26,TOGREG=Y4T(-),
30:1,8,Y4T,SUBMONS,+8,TOGREG=Y4T(/),
45:1,8,Y4T,ADDYEARS,+4,TOGREG=Y4T(.))
OUTFIL REMOVECC,
HEADER1=('INPUT',15:'+26 DAYS',30:'-8 MONTHS',45:'+4 YEARS')
//* |
The output from the above code is
Code: |
INPUT +26 DAYS -8 MONTHS +4 YEARS
20101031 2010-11-26 2010/02/28 2014.10.31
20101101 2010-11-27 2010/03/01 2014.11.01
20101102 2010-11-28 2010/03/02 2014.11.02
|
For complete details of date arithmetic functions and other new functions see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) at:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242 |
|