MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Difference b/w two dates in eztrieve

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Nagavenkata M Purilla
Beginner


Joined: 10 Jun 2008
Posts: 1
Topics: 1

PostPosted: Mon May 02, 2011 1:27 pm    Post subject: Reply with quote

Hi,

i want to find out the difference b/w two dates in eztrieve.

My input file layout:
aaaaaaaaa 01/13/2012
aaaaaaaaa 02/13/2013
aaaaaaaaa 03/13/2014
aaaaaaaaa 04/13/2015

I want to find the diff b/w the input date and current date. Please help me

Thanks
Muralidhar
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue May 03, 2011 10:32 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group