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
 

 

Include records within a date range using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Include records within a date range using SORT
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    Post subject: Reply to: Include records within a date range using SORT
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    Post subject: Include records within a date range using SORT
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    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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


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