|
View previous topic :: View next topic
|
| Author |
Message |
adoerner
New User
Joined: 25 Apr 2007 Posts: 11 Location: Germany
|
|
|
|
Hello !
I'm using DFSORT/Icetool in JCL.
In the input record I have a date field with format YYYYDDMM:
Input:
20070430
I want to increase the date by one day:
Output:
20070501
Is this possible ?
Greets, Axel |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Sort products do not have built-in functions for arithmetic on date fields. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
adoerner,
With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707, you can use the new date conversion function TOGREG/TOJUL like shown below to get the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20070228
20070430
20080229
20081231
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=110,
IFTHEN=(WHEN=INIT,OVERLAY=(81:1,8,Y4T,TOJUL=Y4T)),
IFTHEN=(WHEN=INIT,OVERLAY=(81:+1,ADD,81,7,ZD,M11,LENGTH=7)),
IFTHEN=(WHEN=INIT,OVERLAY=(01:81,7,Y4T,TOGREG=Y4T)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'*'),OVERLAY=(88:81,4,C'1231',
88,8,Y4T,TOJUL=Y4T,81:+1,ADD,81,4,ZD,EDIT=(TTTT),
85,3,ZD,SUB,100,3,ZD,EDIT=(TTT),01:81,7,Y4T,TOGREG=Y4T))
//* |
The output is
| Code: |
20070301
20070501
20080301
20090101
|
For complete details on date conversion functions and the other new functions available with the Nov, 2009 DFSORT PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174 |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
adoerner,
With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct, 2010), adding number of days is much easier like shown below
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20070228
20070430
20080229
20081231
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(1,8,Y4T,ADDDAYS,+1,TOGREG=Y4T)
//*
|
The output from this job is
| Code: |
20070301
20070501
20080301
20090101
|
For complete details on the new DFSORT and ICETOOL functions available with the Oct, 2010 PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242 |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|