ACCEPT parameter is an OUTFIL option that limit the number of input records accepted for OUTFIL processing. A record is “accepted” if it is not deleted by STARTREC, ENDREC, SAMPLE, INCLUDE or OMIT processing. ACCEPT makes it easy to limit the number of OUTFIL input records selected for processing. After n OUTFIL input records have been accepted, additional OUTFIL input records are not included in the data sets for this OUTFIL group.
If ACCEPT=n is specified with SAVE, it will be applied to the saved records. ACCEPT=n operates in a similar way to the ENDREC=n option. However, whereas ENDREC=n stops processing OUTFIL input records for a group at relative record n, ACCEPT=n stops processing OUTFIL input records for a group after n records have been “accepted”. If both ACCEPT=n and ENDREC=n are specified, processing will stop when the first criteria is met.
SYNTAX:
>>-ACCEPT=n-------------------------------------------------><
n: specifies the number of records to be accepted. The value for n starts at 1 and is limited to 28 digits (15 significant digits).
Sample ACCEPT:
OUTFIL FNAMES=OUT1,INCLUDE=(11,3,CH,EQ,C'D51'),ACCEPT=3 OUTFIL FNAMES=OUT2,STARTREC=5,SAMPLE=1000,ACCEPT=12
ACCEPT Example 1
SYSIN: OPTION COPY OUTFIL FNAMES=OUT1,INCLUDE=(11,3,CH,EQ,C'D51'),ACCEPT=3 OUTFIL FNAMES=(OUT2A,OUT2B),STARTREC=2,ACCEPT=5 OUTFIL FNAMES=OUT3,INCLUDE=(11,3,CH,EQ,C'D51'),ACCEPT=3,ENDREC=5
This example illustrates how you can stop processing OUTFIL input records for various groups in different ways. The SORTIN data set has these input records:
INPUT: HEADER 2010/06/30 FRANK D51 ED D52 VICKY D51 MARTIN D52 LILY D50 MARC D51 JUNE D51 LUCY D51 TRAILER 8
OUTPUT:
The first OUTFIL statement uses INCLUDE to extract the D51 records and ACCEPT=3 to only write the first three D51 records to OUT1. Thus, OUT1 will have these records:
FRANK D51 VICKY D51 MARC D51
The second OUTFIL statement uses STARTREC=2 to skip the HEADER record and ACCEPT=5 to only write the next five records to OUT2A and OUT2B. Thus, OUT2A and OUT2B will have these records:
FRANK D51 ED D52 VICKY D51 MARTIN D52 LILY D50
The third OUTFIL statement uses INCLUDE to extract the D51 records, ENDREC=5 to stop at relative record 5 (MARTIN), and ACCEPT=3 to accept a maximum of three records. In this case, there are only two D51 records before relative record 5 so ENDREC=5 is satisfied before ACCEPT=3 and only two records are written to OUT3 as follows:
FRANK D51 VICKY D51
ACCEPT Example 2
SYSIN: OPTION COPY OUTFIL FNAMES=X1,STARTREC=2,ENDREC=5 OUTFIL FNAMES=X2,SAVE,ACCEPT=3
This example illustrates how you can use ACCEPT=n with SAVE processing. The SORTIN data set has these input records:
INPUT: R01 R02 R03 R04 R05 R06 R07 R08 R09 R10
OUTPUT:
The first OUTFIL statement uses STARTREC=2 and ENDREC=5 to write relative records two through five to X1. Thus, X1 will have these records:
R02 R03 R04 R05
The second OUTFIL statement uses SAVE and ACCEPT=3, so it will write the first three saved records to X2. The saved records are those NOT written to X1 (R01, R06-R10), so X2 will have these records:
R01 R06 R07