DFSORT: OUTFIL,OUTREC,INREC, INCLUDE

The tricky words in DFSORT are OUTFIL, OUTREC, INREC and INCLUDE. About these asked in many interviews. This post tells you how to use these correctly. Read my first-post tips ( installment #1), before you go into details.


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.

DFSORT: OUTFIL,OUTREC,INREC, INCLUDE

Example to understand clearly.

Explained how to use – INCLUDE, INREC, SORT, OUTREC, OUTFIL.

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.

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.

Comments are closed.