codegurukool.com · Free coding tutorials & online compiler

Home › Mainframe Tutorial › DFSORT utility

DFSORT utility

Sort and merge records.

The SORT program sorts records. SORTIN is the input, SORTOUT is the output and the control statement in SYSIN says how: SORT FIELDS=(1,6,CH,A) sorts 6 characters from column 1 in ascending order.

Example code

//SORTJOB JOB (ACCT),'SORT',CLASS=A,MSGCLASS=X
//STEP1    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
CHERRY
APPLE
BANANA
/*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=(1,6,CH,A)
/*

Run this code in the online editor

← DD statements and DISPIEBGENER and IEFBR14 utilities →