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 Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am


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