Sorting Multiple Fields in DFSORT


Let us sort records in the bookstore data set by specifying multiple control fields. When you specify two or more control fields, you specify them in the order of greater to lesser priority. Note that control fields might overlap or be contained within other control fields.

I want to sort in the following fields:

  1. Course department
  2. Course number
  3. Instructor’s last name
  4. Instructor’s initials
  5. Book title

So, if two records have the same department, they are sorted by course number. If they also have the same course number, they are sorted by instructor’s last name. If they also have the same last name, they are sorted by initials. Finally, if they also have the same initials, they are sorted by title.

SORT FIELDS=(11ð,5,CH,A,115,5,CH,A,145,15,CH,A,16ð,2,CH,A,1,75,CH,A)


One thought on “Sorting Multiple Fields in DFSORT

  1. Pingback: ICETOOL in Job control Language (JCL) of Mainframe (1 of 4) | Srinimf

Comments are closed.