View previous topic :: View next topic
|
Author |
Message |
Parthasarathy
New User
Joined: 24 Feb 2006 Posts: 18 Location: Chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
|