When I place the exactly same content in a dataset to use in SYSIN, the result is different.
Using this way I got a wrong result.
//SYSIN DD DSN=dataset-with-sysin,DISP=SHR
code inside dataset-with-sysin: lrecl 80
SORT FIELDS=(01,01,ZD,A, ** TIP-REG
16,04,ZD,A, ** ANO DT-JTRB
13,02,ZD,A, ** MES DT-JTRB
10,02,ZD,A, ** DIA DT-JTRB
02,08,ZD,A) ** NR-PSSL
INREC FIELDS=(01,231,16,04,13,02,10,02)
OUTFIL INCLUDE=((232,08,ZD,EQ,20130924,AND,
02,08,ZD,GT,00070000),OR,
232,08,ZD,GT,20130924,OR,
1,1,ZD,EQ,0,OR,1,1,ZD,EQ,9),
OUTREC=(01,231)
16,04,ZD,A, ** ANO DT-JTRB
13,02,ZD,A, ** MES DT-JTRB
10,02,ZD,A, ** DIA DT-JTRB
02,08,ZD,A) ** NR-PSSL
INREC FIELDS=(01,231,16,04,13,02,10,02)
OUTFIL INCLUDE=((232,08,ZD,EQ,20130924,AND,
02,08,ZD,GT,00070000),OR,
232,08,ZD,GT,20130924,OR,
1,1,ZD,EQ,0,OR,1,1,ZD,EQ,9),
OUTREC=(01,231)
This way works:
//SORT001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=My-dataset,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(01,01,ZD,A, ** TIP-REG
16,04,ZD,A, ** ANO DT-JTRB
13,02,ZD,A, ** MES DT-JTRB
10,02,ZD,A, ** DIA DT-JTRB
02,08,ZD,A) ** NR-PSSL
INREC FIELDS=(01,231,16,04,13,02,10,02)
OUTFIL INCLUDE=((232,08,ZD,EQ,20130924,AND,
02,08,ZD,GT,00070000),OR,
232,08,ZD,GT,20130924,OR,
1,1,ZD,EQ,0,OR,1,1,ZD,EQ,9),
OUTREC=(01,231)
/*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=My-dataset,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(01,01,ZD,A, ** TIP-REG
16,04,ZD,A, ** ANO DT-JTRB
13,02,ZD,A, ** MES DT-JTRB
10,02,ZD,A, ** DIA DT-JTRB
02,08,ZD,A) ** NR-PSSL
INREC FIELDS=(01,231,16,04,13,02,10,02)
OUTFIL INCLUDE=((232,08,ZD,EQ,20130924,AND,
02,08,ZD,GT,00070000),OR,
232,08,ZD,GT,20130924,OR,
1,1,ZD,EQ,0,OR,1,1,ZD,EQ,9),
OUTREC=(01,231)
/*
sortin content: lrecl 231
0header
10000000124.09.2013
...
10007000024.09.2013
9trailer
The result should have only the header and trailer, but when placing SYSIN logic inside a dataset, all records are placed in the result dataset.
It as if it only had an OPTION COPY ...