View previous topic :: View next topic
|
Author |
Message |
gabriel.ryoga
New User
Joined: 07 Jun 2007 Posts: 31 Location: Spain
|
|
|
|
Input:
Code: |
20080520 20080526
20080525 20080526
|
Output:
Code: |
20080520 20080526 00006
20080525 20080526 00001
|
I need to calculate the number of days between two dates.... |
|
Back to top |
|
|
bbharathiraj Warnings : 1 New User
Joined: 26 Oct 2006 Posts: 50 Location: Chennai
|
|
|
|
I also tried to achieve like this same. If some one help me to get the output for the following
I have a date on my input file which is record created date in table.
For example,
Code: |
20080520 rajak
20080525 frank |
I have to calculate the number of days with the current system date. And if the number of days fall in 0-5 days then I have to write as A in the same file at the last column.
If the number of days fall in 6-10 days then I have to write as B in the same file at the last column.
So the output should be like as below if the system date is 05/26/2008.
Code: |
20080520 rajak B
20080525 frank A |
Thanks in advance! |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
The following DFSORT JCL will give you the desired results
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20080520 RAJAK
20080525 FRANK
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,OVERLAY=(81:DATE1-5)),
IFTHEN=(WHEN=(1,8,CH,LT,81,8,CH),OVERLAY=(16:C'B')),
IFTHEN=(WHEN=NONE,OVERLAY=(16:C'A'))
/* |
Hope this helps... |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
Skolusu,
Can you please give the solution for gabriel's post also. I just want to know how to get the difference of dates. Is it possible in DFSORT to get the days between dates...
Regards
Amar |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
gabriel.ryoga/V S Amarendra Reddy,
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 *
----+----1----+----2----+----3----+----4----+-
20080520 20080526
20080525 20080526
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(20:10,8,Y4T,DATEDIFF,1,8,Y4T)
//* |
The output from the above job is
Code: |
20080520 20080526 +0000006
20080525 20080526 +0000001
|
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 |
|
Back to top |
|
|
|