---
title: "How to ‘Sort’ Input dataset in JCL"
description: "Sort card you can write in JCL to select few fields from input dataset and after sorting you can write those records into output file. The JCL is good sort example."
url: https://srinimf.com/2015/10/16/jcl-to-sort-few-fields-in-an-input-dataset/
date: 2015-10-16
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2015/10/pexels-photo-389818.jpeg?fit=1880%2C1253&ssl=1
categories: ["DFSORT", "JCL"]
tags: ["JCL tips and Tricks", "Sort input file JCL", "Sort JCL sample"]
type: post
lang: en
---

# How to ‘Sort’ Input dataset in JCL

Here is [sample JCL](https://srinimf.com/2016/11/17/the-best-sort-join-key-example-to-create-3rd-data-set/) to use ‘sort’ utility in [JCL to sort](https://srinimf.com/2016/02/03/how-to-sort-3-input-files-using-dfsort-utility-in-jcl/) input dataset. Also, you can write sorted records to output file.

On this page

1. [Sample JCL Sort Utility](#sample-jcl-sort-utility)
2. [Related Posts](#related-post)

![SORT JCL](https://i0.wp.com/cdn.pixabay.com/photo/2017/03/14/17/43/mountain-2143877_960_720.jpg?resize=410%2C273&ssl=1)*SORT JCL*

## 1. Sample [JCL Sort](https://srinimf.com/2015/04/29/jcl-sort-interview-questions/) Utility

```
//EXAMP   JOB A492,PROGRAMMER
//SORT    EXEC PGM=SORT
//SYSOUT  DD   SYSOUT=A
//SORTIN  DD   DSN=A123456.SORT.SAMPIN,DISP=SHR ==> Input file
//SORTOUT DD   DSN=A123456.SORT.SAMPOUT,DISP=OLD ==> Output file
//[SYSIN DD](https://srinimf.com/2011/03/23/jcl-sysin-dd-and-sysin-dd-data/) *
  SORT FORMAT=CH,
  FIELDS=(110,10,A,145,17,A,1,75,A)
/*
```

## 2. 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
- [How to Increase Sort Performance with SORTWKxx Dataset](https://srinimf.com/2015/08/30/mainframe-how-sortwkxx-datasets-increases-sort-performance-in-jcl/)DateAugust 30, 2015
- [Ideas: How to Split the File Using OUTFIL](https://srinimf.com/2016/08/04/tip-to-split-input-file-with-outfil/)DateAugust 4, 2016

### 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%2F2015%2F10%2F16%2Fjcl-to-sort-few-fields-in-an-input-dataset%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2015%2F10%2Fpexels-photo-389818.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=How%20to%20%27Sort%27%20Input%20dataset%20in%20JCL)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2015/10/16/jcl-to-sort-few-fields-in-an-input-dataset/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2015/10/16/jcl-to-sort-few-fields-in-an-input-dataset/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2015/10/16/jcl-to-sort-few-fields-in-an-input-dataset/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2015/10/16/jcl-to-sort-few-fields-in-an-input-dataset/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20How%20to%20%27Sort%27%20Input%20dataset%20in%20JCL&body=https%3A%2F%2Fsrinimf.com%2F2015%2F10%2F16%2Fjcl-to-sort-few-fields-in-an-input-dataset%2F&share=email)
-

### Like this:

Like Loading…
