Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to calculate the number of days between two dates

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
gabriel.ryoga

New User


Joined: 07 Jun 2007
Posts: 31
Location: Spain

PostPosted: Mon May 26, 2008 2:14 pm    Post subject: Need to calculate the number of days between two dates
Reply with quote

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
View user's profile Send private message

bbharathiraj
Warnings : 1

New User


Joined: 26 Oct 2006
Posts: 50
Location: Chennai

PostPosted: Mon May 26, 2008 7:41 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 27, 2008 10:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 189
Location: INDIA

PostPosted: Thu May 29, 2008 7:50 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 29, 2008 8:06 am    Post subject:
Reply with quote

Hello Amar,

Please check this prior topic:
http://ibmmainframes.com/viewtopic.php?t=29164
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Nov 02, 2010 4:15 am    Post subject:
Reply with quote

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:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
No new posts How to find jobs that are in schedule... anilkumar922 All Other Mainframe Topics 5 Tue Jun 28, 2016 10:01 am
No new posts GDG vsersion number change Raghu navaikulam JCL & VSAM 5 Fri May 27, 2016 4:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us