Great to to start here…
The most confusing keywords of DFSORT. The words like OUTFIL, OUTREC, INREC and INCLUDE asked in many interviews.
My point is how to tell without confusion…
Read my tips here. Before you go into details read my first post here ( installment #1)
The rules to understand
DFSORT processes the OUTFIL statements after the INREC and OUTREC statements. Therefore, OUTFIL must refer to the reformatted records produced by OUTREC if specified, or to the reformatted records produced by INREC if it is specified without OUTREC.
You will learn about OUTFIL statements in Creating Multiple Output Data Sets and Reports.
Example to make you understand clearly….
The control statements below illustrate how the INREC and OUTREC statements affect the positions you specify for various other statements:
INCLUDE COND=(110,5,CH,EQ,C'ENGL',OR,110,5,CH,EQ,C'PSYCH') INREC FIELDS=(1:1,75,76:170,4,80:110,5) SORT FIELDS=(76,4,BI,D) OUTREC FIELDS=(1:1,75,85:76,4,BI,EDIT=($IT.TT),95:80,5) OUTFIL FNAMES=ENGL,INCLUDE=(95,5,CH,EQ,C'ENGL') OUTFIL FNAMES=PSYCH,INCLUDE=(95,5,CH,EQ,C'PSYCH')
How to differentiate
- The INCLUDE and INREC statements refer to fields as they appear in the input records.
- The SORT and OUTREC statements refer to fields as they appear in the reformatted INREC records.
- The OUTFIL statements refer to fields as they appear in the reformatted OUTREC records.