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
 

 

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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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