Here is sample JCL to use ‘sort’ utility in JCL to sort input dataset. Also, you can write sorted records to output file.
On this page

1. Sample JCL Sort 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 * SORT FORMAT=CH, FIELDS=(110,10,A,145,17,A,1,75,A) /*






