---
title: "Ideas: How to Split the File Using OUTFIL"
description: "Easy to write JCL in DFSORT to split input file using OUTFIL option."
url: https://srinimf.com/2016/08/04/tip-to-split-input-file-with-outfil/
date: 2016-08-04
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2016/08/dfsort-tips-ideas.jpg?fit=1200%2C900&ssl=1
categories: ["DFSORT"]
tags: ["DFSORT JCL to Split input data set"]
type: post
lang: en
---

# Ideas: How to Split the File Using OUTFIL

**This is a [sample JCL](https://srinimf.com/2016/11/17/the-best-sort-join-key-example-to-create-3rd-data-set/) [to split](https://srinimf.com/2017/06/13/2-best-ways-split-a-file-using-dfsort/) the input dataset** into multiple output files. The OUTFIL operands INCLUDE, OMIT and SAVE can be used to select the records to be included in each output data set.

Related[JCL- Sort OUTFIL FNAMES (1 of 3)](https://srinimf.com/2012/05/29/jcl-sort-outfil-fnames-1-of-3/)

---

![Norway Culture](https://i0.wp.com/srinimf.com/wp-content/uploads/2019/01/my-post1.jpg?resize=578%2C324&ssl=1)

SAVE can be used to select the records that are not selected for any other subset, eliminating the need to specify complex conditions.
Here’s an example of OUTFIL subsets:

```
//SYSIN DD *   
 OUTFIL INCLUDE=(8,6,CH,EQ,C'ACCTNG'),FNAMES=GP1  
 OUTFIL INCLUDE=(8,6,CH,EQ,C'DVPMNT'),FNAMES=GP2  
 OUTFIL INCLUDE=(8,6,SS,EQ,C'ADMIN ,RESRCH'),FNAMES=GP3 
 OUTFIL SAVE,FNAMES=NOT123 /*
```

**Explanation**

- Records with ACCTNG in positions 8-13 are written to the GP1 data set.
- Records with DVPMNT in positions 8-13 are written to the GP2 data set.
- Records with ADMIN or RESRCH in positions 8-13 are written to the GP3data set.
- Records without ACCTNG, DVPMNT, ADMIN or RESRCH in positions 8-13 are written to the NOT123

Related Posts

- [Best JCL Interview Questions – Splitting Input File](https://srinimf.com/2014/09/04/best-jcl-interview-questions-splitting-input-file/)DateSeptember 4, 2014
- [10 Top Uses of Mainframe DFSORT Utility](https://srinimf.com/2015/05/01/zos-how-dfsort-works-in-simple-way/)DateMay 1, 2015
- [DFSORT: How to Use Conditional Include In OUTFIL](https://srinimf.com/2015/04/29/jcl-conditional-include-in-outfil-statement/)DateApril 29, 2015

### 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%2F2016%2F08%2F04%2Ftip-to-split-input-file-with-outfil%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2016%2F08%2Fdfsort-tips-ideas.jpg%3Ffit%3D1200%252C900%26ssl%3D1&description=Ideas%3A%20How%20to%20Split%20the%20File%20Using%20OUTFIL)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2016/08/04/tip-to-split-input-file-with-outfil/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2016/08/04/tip-to-split-input-file-with-outfil/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2016/08/04/tip-to-split-input-file-with-outfil/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2016/08/04/tip-to-split-input-file-with-outfil/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20Ideas%3A%20How%20to%20Split%20the%20File%20Using%20OUTFIL&body=https%3A%2F%2Fsrinimf.com%2F2016%2F08%2F04%2Ftip-to-split-input-file-with-outfil%2F&share=email)
-

### Like this:

Like Loading…
