SORT Statement



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

SORT Statement

Postby Vineet » Tue Nov 03, 2009 3:35 pm

Hi All,

I am having Query Regarding SORT Statement. I am having a Sequential File (Dynamic in nature) i.e. Record Count Vary on daily Basis, say On 3rd/Nov/2009 Record Count = 5000, 4/Nov/2009 Record Count = 10000, 5/Nov/2009 Record Count = 50
I want to get Last 500 Records How To Achieve this?. For 5/Nov/2009 will I be Getting Error or On 50 Records will be Fetched.

Thanks
Kind Rgds

Vineet Anand
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: SORT Statement

Postby Vineet » Tue Nov 03, 2009 5:09 pm

Let be More e Precise with the requirement. I want to Write last 500 Records to a Output File.
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: SORT Statement

Postby Frank Yaeger » Tue Nov 03, 2009 10:24 pm

I want to Write last 500 Records to a Output File.


You can use a DFSORT/ICETOOL job like the following to do that:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST(500)
/*


If you have 500 or more records in IN, you will get the last 500 records. If you have less than 500 records in IN, you will get all of the records.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post