Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us