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
 
Adding 'n' days to a given date using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Adding 'n' days to a given date using SORT
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

Site Director


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

PostPosted: Fri May 08, 2009 10:06 am    Post subject:
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:
http://ibmmainframes.com/viewtopic.php?t=29164
http://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    Post subject: Re: Adding 'n' days to a given date using SORT
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:

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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am

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