Sort Multiple file with Diff LRECL's

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Posts: 43
Joined: Thu Oct 21, 2010 11:17 pm

Sort Multiple file with Diff LRECL's

Post by hparthas » Tue Oct 11, 2011 10:45 pm

Hi All,

I have a requirement and I have to do this in different steps, is there any way that we can do this in a single SORT STEP.


1) 11 input files and all are different LRECL.
2) My sort key for all 11 diffferent file are @ different positions.
3) Currently 11 output files are created since I have done it in different steps.
4) Can I merge all the 11 different files, into a single VB file, so that I can avoid space issue. Since I will huge data in my input file.

Below are the file input specifications.

Code: Select all

File Name	Record Format	LRECL	Key Field

Inp File1 - 	FB		100	From 10 - 12
Inp File2 - 	FB		200	From 110 - 112
Inp File3 - 	FB		300	From 16 - 18
Inp File4 - 	FB		400	From 67 - 69
Inp File5 - 	FB		500	From 34 - 36
Inp File6 - 	FB		600	From 99 - 101
Inp File7 - 	FB		700	From 58 - 60
Inp File8 - 	FB		100	From 87 - 89
Inp File9 - 	FB		600	From 21 - 23
Inp File10 - 	FB		300	From 11 - 13
Inp File11 - 	FB		400	From 44 - 46
My O/p file should be a VB file, and maximum LRECL of 700.

Any help would be great.

Many thanks in advance.


User avatar
Frank Yaeger
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA

Post by Frank Yaeger » Tue Oct 11, 2011 11:00 pm

For a single SORT, the keys must all be in the same position. Since your keys are in different positions, you would have to create a "normalized" key for each file before you can sort them. For example, you can make a copy of the key from each file after the RDW, the sort on that key, and then revmove it.

You can't do that in a single pass. Of course, you could do it in a single step with multiple passes using DFSORT's ICETOOL.
Frank Yaeger - DFSORT Development Team (IBM) -
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at

Posts: 43
Joined: Thu Oct 21, 2010 11:17 pm

Post by hparthas » Wed Oct 12, 2011 4:16 pm


Thanks a lot for your help in this.

Have moved all the key fields to a particular position and then sorted the complete file.


Post Reply


Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Mainframe Interview questions

Other References
Mainframe Tools and others