Sort Overlay JCL real example to use Quickly

I have explained how to overlay the field values by using mainframe DFSORT utility.

Overlay Example..

* Skip the first three records 
* Keep records that meet the specified field-to-field or 
* field-to-constant selection criteria 
INCLUDE COND=(7,5,PD,LE,22,5,PD,OR,25,3,CH,EQ,C'J69') 
* Add a sequence number to the remaining records. 
* Sort the records. 
SORT FIELDS=(20,8,ZD,A,11,2,CH,D) 
* Produce one record for each unique sort key with totals 
* for the specified summary fields 
SUM FIELDS=(45,4,BI,8,2,PD) 
* Produce output records displaying the sort and sum fields
* intermixed with constants and arithmetic operations. 
OUTREC BUILD=(8C'0',20,8,ZD,M11,4X,11,2,4C'*', 
45,4,BI,M11,4X,8,2,PD,M11, ((32,6,PD,MUL,-50),ADD,58,3,ZD),M11,LENGTH=8, 73,8) 
* Produce three output data sets from one pass over the input 
DFSORT Best Examples

DFSORT Best Examples

Useful for interviews and projects.


Detailed Explanation for Overlay

Using OVERLAY, you reformat each record by specifying just the items that overlay specific columns.

OVERLAY lets you change specific existing columns without affecting the entire record.

In the below example,

Starts from position 45, and length 8, translating lower case to upper case. This example clearly tells how we can use Overlay.

One of the frequently asked interview Question, in IBM, Tech Mahindra, CTS, and Dell. Why means all financial projects using Sort, to sort all reports.

The OVERLAY you can apply in both INREC and OUTREC formatting.

Recent 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.