DFSORT Top Ideas on Sorting of Multiple Fields

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 a 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.

Syntax to Sort Multiple Fields

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

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.