IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Include records within a date range using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Satish5

New User


Joined: 12 Nov 2007
Posts: 38
Location: Texas, USA

PostPosted: Tue Sep 29, 2009 5:17 pm
Reply with quote

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
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Sep 29, 2009 9:57 pm
Reply with quote

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)               
/*                                                                   
Back to top
View user's profile Send private message
Satish5

New User


Joined: 12 Nov 2007
Posts: 38
Location: Texas, USA

PostPosted: Thu Oct 01, 2009 8:57 am
Reply with quote

Thanks Kolusu !
This solution worked for me.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top