Community Help: JCL Sort - Example of using JCL and dfsort - Limiting data columns on output
Share your own experience
View front page
JCL sort is actually really easy to do and very easy to limit the number or columns or positions on the output file. You simply just call the sort job, pass it the files, and tell it the parms on what type of sorting you want and also what data you want to appear on the output result file, and what limitations if any. For example, if you want your JCL to only include a certain fields or columns on the final result file, just use the sample parms on your sysin as shown:
//SYSIN DD *
OUTREC FIELDS=(1,92,C'80',93,10) (This is simple. What this means is that you want your output file to show only the first 92 bytes of the input file (i.e. position 1 to 92), and then followed by a hard coded 80 (you are telling it to put a 2 byte character there which is 80), and then followed by the next 10 bytes of your input file (i.e. you are telling it to then copy to the output file whatever is in position 93 of the input file, for 10 bytes). The outrec example is simple once you use it a few times. Basically you are just identifying what field on the input to be included on the output, and its called the outrec parameter.