Are the records really numbered like that and is the record to be selected indicated by a number? Or is it more complicated than that? If so, then please give a more accurate description of the input records (real values) and how you identify the specified record (real value or relative record number or ?).
Also, where are N=1 and 4 found - are they values you will hardcode, or in a file, or what?
Are you only looking for one set of records (e.g. 3-5, or are you really looking for multiple sets of records (e.g. 3-5, 9-11 and 21-23)?
The records are more complicated than that mentioned above.. actually, the file contains much account information. and the using account number as the Key(S(19))..
my aim is. according to the given account number, to sort out records before and after that account... because the file contains more 1 million records, and record length is more than 60,000 byte. I hope this helps...
You still haven't described what you're trying to do in enough detail for me to help you. You didn't answer my question about whether you're looking for one set of records or multiple sets of records, or how you specify the needed information about the target account and "spread". It isn't clear if you want to extract the records before or after they are sorted (or even if you want them sorted).
record length is more than 60,000 byte
Huh? DFSORT cannot handle files with records that big. What type of file is it? What are its attributes (RECFM? LRECL?).
Here's a DFSORT/ICETOOL job that will do what you asked for. It will work fine unless you don't have the number of records specified before the target record (for example, if you ask for record 2 with N=+2) - that could be fixed, but I didn't bother at this point since I don't know if you will ever have that situation.
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYMNAMES DD *
* Specify target account number as string
* Specify number of records before and after as +d (+ is required)
//IN DD DSN=... input file (FB)
//CTL2CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT DD DSN=... output file (FB)
//TOOLIN DD *
COPY FROM(IN) TO(CTL2CNTL) USING(CTL1)
COPY FROM(IN) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
BUILD=(C' OPTION SKIPREC=',