---
title: "DFSORT: OUTFIL,OUTREC,INREC, INCLUDE"
description: "There is a simple way that you will become good in DFSORT. Follow these tips to understand keywords present in DFSORT clearly. Read more."
url: https://srinimf.com/2010/11/28/outfil_outrec/
date: 2010-11-28
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2010/11/living-room-couch-interior-room-584399.jpeg?fit=1880%2C1244&ssl=1
categories: ["JCL"]
tags: ["JCL DFSORT", "OUTREC in JCL"]
type: post
lang: en
---

# DFSORT: OUTFIL,OUTREC,INREC, INCLUDE

The tricky words in DFSORT are OUTFIL, OUTREC, INREC, and INCLUDE. These are [asked in many](https://srinimf.com/2015/06/26/these-cobol-file-status-codes-asked-in-many-mainframe-interviews/) interviews. This post tells you [how to use](https://srinimf.com/2015/04/29/jcl-conditional-include-in-outfil-statement/) these correctly. Read my first-post tips ( [installment #1](http://srinimf.com/2010/12/04/jclsort-syntax-ifthen)), before you go into details.

## The rules to understand

DFSORT processes the OUTFIL statements after the [INREC and OUTREC](https://srinimf.com/2013/03/19/inrec_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 understand clearly.

Explained [how to](https://srinimf.com/2016/01/21/2-best-ideas-on-how-to-re-order-fields-with-build-option-in-dfsort/) use – INCLUDE, INREC, SORT, OUTREC, OUTFIL.

[INCLUDE COND](https://srinimf.com/2015/05/12/jcl-include-omit-examples/)=(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](https://srinimf.com/2012/04/26/jcl-sort-pd-to-zd-with-length-calculation/)=(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.

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2010%2F11%2F28%2Foutfil_outrec%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2010%2F11%2Fliving-room-couch-interior-room-584399.jpeg%3Ffit%3D1200%252C794%26ssl%3D1&description=DFSORT%3A%20OUTFIL%2COUTREC%2CINREC%2C%20INCLUDE)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2010/11/28/outfil_outrec/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2010/11/28/outfil_outrec/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2010/11/28/outfil_outrec/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2010/11/28/outfil_outrec/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20DFSORT%3A%20OUTFIL%2COUTREC%2CINREC%2C%20INCLUDE&body=https%3A%2F%2Fsrinimf.com%2F2010%2F11%2F28%2Foutfil_outrec%2F&share=email)
-

### Like this:

Like Loading…
