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