DFSORT Top Example JCL to Sort 3 input Files

DFSORT is a top Sorting utility. Reporting tasks you can do quickly if you know how to use DFSORT correctly.


In all financial projects like Banking, Capital Market and Insurance projects do use DFSORT utility extensively.

Example DFSORT JCL Along With an Explanation

//EXAMP JOB A123,PROGRAMMER 
 //S1 EXEC PGM=SORT 
 //SYSOUT DD SYSOUT=A 
 //SORTIN DD DSN=INPUT.FILE1,DISP=SHR 
 //       DD DSN=INPUT.FILE2,DISP=SHR 
 //       DD DSN=INPUT.FILE3,DISP=SHR 
 //SORTOUT DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE), 
 //           SPACE=(CYL,(5,5)),UNIT=SYSDA 
 //SYSIN DD * 
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'HDR'),
  OVERLAY=(6:YDDD=(D4/),81:C'0',82:SEQNUM,2,ZD)),
/* IFTHEN works on header record
  IFTHEN=(WHEN=(1,3,CH,EQ,C'TRL'),
  OVERLAY=(11:YDDD=(D4/),81:C'9',82:SEQNUM,2,ZD)),
/* IFTHEN works on trailer record
  IFTHEN=(WHEN=NONE, OVERLAY=(81:C'1')) 
/*IFTHEN works on details records
  SORT FIELDS=(81,1,CH,A,8,5,CH,A) 
/*Sorts input record
  OUTFIL REMOVECC, 
/*REMOVECC  removes the ANSI carriage control 
/*characters and ensures that the RECFM is FB rather than FBA
  OMIT=(81,1,SS,EQ,C'0,9',AND,82,2,ZD,GT,+1), 
/*This Omits records matching to the given criteria
 OUTREC=(1,80) => It keeps only 80 byte data
/*

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.