IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

date arithmetic possible for variable date fields ?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Frank Silven

New User


Joined: 21 Apr 2010
Posts: 1
Location: Amsterdam Airport

PostPosted: Wed Apr 21, 2010 6:35 pm
Reply with quote

Hi,

Is it possible to add or subtract days to date fields present in the input file ?

Up to now i only came across examples adding/subtracting days from the current system date.

Many thanks for your help.

Thx
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Apr 21, 2010 11:27 pm
Reply with quote

Sort products do not have any built-in functions for doing date field arithmetic.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Nov 03, 2010 12:25 am
Reply with quote

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
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top