AJAYREDDY New User Joined: 17 Feb 2007 Posts: 52 Location: USA
I need to extract records from a file. I need n records from Key value. The Key starts at position 2 , 10 bytes.
For example if KEY is ABCD123456 which is 10 bytes Character, I need next 50000 records starting from this KEY. I tried with INCLUDE COND but it is no use. It only extracts 1 record in output file. I tried with OPTION STOPAFT=50000 but do not know how/where to specify the starting Key value.
notonly4u New User Joined: 26 Apr 2005 Posts: 87 Location: Hyderabad
Is your key is in sorted order?
If so, try giving GT your key and stopaft 50000
Escapa Senior Member Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
Assuming your input dataset LRECL is 80
Below is sortstep to give desired result.
//S1 EXEC PGM=SORT
//SORTIN DD DSN=yourinutdatasethere
//SORTOUT DD DSN=youroutputdatasethere
//SYSOUT DD SYSOUT=*
//SYSIN DD *
Frank Yaeger DFSORT Moderator Joined: 15 Feb 2005 Posts: 7130 Location: San Jose, CA
Note that you are also assuming that there is only one ABCD123456 record in the file. Because a second ABCD123456 record would start a new group with a sequence number of 1, e.g.
ABCD123456 1 <- seqnum starts at 1 again
If there is only one ABCD123456 record, then this would be simpler:
OUTFIL INCLUDE=(81,1,CH,NE,C' '),
All times are GMT + 6 Hours