View previous topic :: View next topic
|
Author |
Message |
smaru
New User
Joined: 22 Oct 2008 Posts: 49 Location: India
|
|
|
|
All,
I have a requirement . There is a file containing records from date 2000-02-09 to 2008-02-09.Is there a way through DFSORT to check the date parameter ? If so, my requirement is to remove all records less than 2007-02 ( year - 1) from one file and write those out to another.
It could be a weird question , but if anyone could help me that would be great.
Thanks in advance. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
when you say year-1 did you mean current date - 1 year? You are already in 2009 , so year -1 would be 2008-02. If that is the case the following JCL will give you the desired results. Date2(-) is of the format YYYY-MM
so current YYYY-MM - 12 = 2009-02 - 12 = 2008-02
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2000-02-09
2001-03-05
2007-02-09
2007-06-09
2008-01-09
2008-03-10
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OMIT COND(1,7,CH,LT,DATE2(-)-12)
/* |
The output from the above job
|
|
Back to top |
|
|
|