Satish5
New User
Joined: 12 Nov 2007 Posts: 38 Location: Texas, USA
|
|
|
|
Hi,
I have a VSAM file that has a date field (yyddd). I want to extract records that falls within a specific date range such as between 1st day of current year and last day of previous month. For e.g if I run today then only records ranging between 1-Jan-2009 and 31-Aug-2009 should be fetched. Please suggest how I can achieve this.
Thanks,
Satish |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
satish5,
The following DFSORT JCL will give you the desired results
I assumed that your input is FB and lrecl of 80 bytes.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
08365 - DROP
09001 - PICK
09366 - DROP
09244 - DROP
09243 - PICK
09022 - PICK
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:YDDDNS=(YD),DATE1)),
IFTHEN=(WHEN=INIT,OVERLAY=(94:88,2,83,3,ZD,SUB,92,2,ZD,EDIT=(TTT))),
IFTHEN=(WHEN=(96,3,ZD,EQ,0),OVERLAY=(96:C'001'))
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:94,5,94,2,C'001',8X))
OUTFIL BUILD=(1,80),
INCLUDE=(1,5,Y2T,GE,86,5,Y2T,AND,1,5,Y2T,LE,81,5,Y2T)
/* |
|
|