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
 

 

date arithmetic possible for variable date fields ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: date arithmetic possible for variable date fields ?
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 Moderator


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

PostPosted: Wed Apr 21, 2010 11:27 pm    Post subject:
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    Post subject:
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:

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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm


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