Skip first n records and last n records in a file

2 posts / 0 new
Last post
Anonymous
Skip first n records and last n records in a file

 

I have to skip first N records and last N records in a file, can any one suggest a way 
using SYNCSORT to do this.
 
Actually my file has first 5 records as header and last 5 records are trailer records which are not required in the ouput file.
 
I could fine a command SKIPREC which would skip a certain number of records from top,but I am not sure as to how can I skip 
records from bottom.
"; ; ; ;
Anonymous
RE:Skip first n records and last n records in a file

 

You can easily skip records from top by using SKIPREC command. But for skipping records from bottom, you may consider the following 
approach
 
 -Add a sequence number atthe end of the file(using SEQNUM,7,ZD as the sortcard
 
 -Sort the file by the sequence number in descending order, which will bring records from bottom to top.
 
 -Now use skiprec to skip n records
 
 -Sort the file again in ascending order of sequence number, to bring it back to original order.
 
 -Remove the sequence number using INREC/OUTREC
 
Log in or register to post comments
Sponsored Listing