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

How to add one day to current date using sort


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

New User


Joined: 06 Mar 2006
Posts: 50
Location: PUNE

PostPosted: Thu Feb 01, 2007 2:28 pm
Reply with quote

Please help me,,, How to add one day to current date using sort.

Eg : //SORTIN DD *
20061231
//SORTOUT DD SYSOUT=*

SORTOUT should be 20070101

Thanks,
Anand
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: Thu Feb 01, 2007 9:44 pm
Reply with quote

Sort products do not have any built-in functions for doing "arithmetic" on date fields, so you can't take a record with a date and add 1 to that date.
However, if you just want the current date + 1 in the form 'yyyymmdd', you can use this DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN   
//SYSOUT    DD  SYSOUT=*   
//SORTIN DD *               
RECORD         
/*             
//SORTOUT DD SYSOUT=*       
//SYSIN    DD    *         
  OPTION COPY               
  INREC BUILD=(DATE1+1)     
/*
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Oct 26, 2010 4:49 am
Reply with quote

Anand78,

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 *                               
20061231                                       
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  SORT FIELDS=COPY                             
  INREC BUILD=(1,8,Y4T,ADDDAYS,+1,TOGREG=Y4T) 
//*


The output from the above is
Code:

20070101



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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top