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

Adding 'n' days to a given date using SORT


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

New User


Joined: 24 Feb 2006
Posts: 18
Location: Chennai

PostPosted: Fri May 08, 2009 9:52 am
Reply with quote

Hi,
I have a file of 26 Byte LRECL, FB and the data as follows.
1-10 - Key field
11-18 - Date in CCYYMMDD format.

My requirement is to calculate the new date which is given date(position at 11-18) +7 days and assign it to 3rd field (position 19-26).

I tried searching this forum but coudn't find a match for my requirement. Can anyone please help?

Thanks in advance
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri May 08, 2009 10:06 am
Reply with quote

Hello,

Quote:
I tried searching this forum but coudn't find a match for my requirement. Can anyone please help?
You will probably need to use a different solution. . .

Look at this previous similar topics:
ibmmainframes.com/viewtopic.php?t=29164
ibmmainframes.com/viewtopic.php?t=18157
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:14 am
Reply with quote

Parthasarathy wrote:
Hi,
I have a file of 26 Byte LRECL, FB and the data as follows.
1-10 - Key field
11-18 - Date in CCYYMMDD format.

My requirement is to calculate the new date which is given date(position at 11-18) +7 days and assign it to 3rd field (position 19-26).

I tried searching this forum but coudn't find a match for my requirement. Can anyone please help?

Thanks in advance


Parthasarathy,

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 *                                         
----+----1----+----2----+----3----+----4----+----5----+-
ABC       20101031                                     
DEF       20101101                                     
GHI       20101102                                     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC BUILD=(1,18,11,8,Y4T,ADDDAYS,+7,TOGREG=Y4T)   
//*


The output from the above code is

Code:

----+----1----+----2----+----3----+----4----+----5----+-
ABC       2010103120101107
DEF       2010110120101108
GHI       2010110220101109


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 How to split large record length file... DFSORT/ICETOOL 8
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
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top