- STEP 1.
- Determine the Use attribute number for the type of search result set to sort.
If you are defining the global default sort order the number is always zero (0), otherwise you can open the "search" view in the Horizon Table Editor and look up the number assigned to the search for the PAC Flavor being used.

- The Search column displays the PAC Flavor code.
- The Label column describes the type of search.
- The z39.50 attr column displays the Use attribute number for the search.
In the above example, the Z39.50 Use attribute number assigned to the Author Keyword search, used by the "pac" coded PAC Flavor, is 1003.
Next, you need to determine the Bib List View included in the PAC Flavor used by WebPAC.
- STEP 2.
- In the Horizon Menu Manager, select the "PAC Flavor Table (Flavor)" option listed on the PAC Control Menu (PacCtl) to display the list of Public Access "Flavors" in the Horizon Table Editor.

- STEP 3.
- Highlight the PAC Flavor used by WebPAC and click "Edit" to display the current field values.

- STEP 4.
- Note the name of the Horizon View assigned to the Bib List View field (usually "biblist"), then click "Close" to close the WebPAC PAC Flavor, and then close the view listing the PAC Flavors.

- Now that you know the Bib List View included in the PAC Flavor used by WebPAC, you can look up the MARC Map codes that you need for sorting.
- STEP 5.
- In the Horizon Table Editor, open the Horizon View Definitions (mq_view).

- STEP 6.
- Enter the name of the Horizon View specified in the Bib List View field of the PAC Flavor table used by WebPAC, then click "OK".

- STEP 7.
- Click "Edit" to display the current field values for the single Horizon View listed, then page down to page 3 where the marc_map field should be visible within the List View blink (box).

- STEP 8.
- Click the "Codes" button for the marc_map field to perform a code lookup on the list of available marc_map codes, noting the names of the case-sensitive codes that map the MARC information necessary for the default sorting.

- STEP 9.
- Once you know the codes you need for sorting, click "Cancel" then scroll through the list of List View options to make sure that the MARC Map codes you need are all referenced.
If you cannot find the MARC Map code you need or you find that a code is not referenced, you can refer to the WebPAC MARC Mapped Information Filtering online article for further information on creating a new MARC Map code and adding a MARC Map code to a List View.
- STEP 10.
- Create or modify the Sort file used by the Z39.50 Server program (Zdaemon) to include the case-sensitive MARC Map codes and the Use attribute numbers, corresponding to the numbers in the Horizon Search Table, needed for the default sort orders.
The Sort file (normally named "sort.txt"), a text file referenced by the "/S (capital S)" argument to the Zserver program "zdaemon.exe" or "zdaemon", should be located in the Zserver directory.

This file is organized in separate sections, each section being optional.
- The first line specifies the maximum resultset size (maxrset) past which the result set will not be sorted at all. This gives you some control over the performance impact of sorting.
- In the [Sort] section, you can link Use attributes assigned to keyword searches in the Horizon Search Table (or zero for all searches) to one or two comma-separated MARC Map codes identifying the information to sort by. Each code should be followed by a colon (:) and an A for ascending or a D for descending sort order.
- In the [Restrict] section, unused Use attribute numbers linked to MARC Map codes for filtering are listed.
In the above example, the sort order applied by default to search results will be
- titles A-Z in ascending alphabetical order then newest to oldest Date of Publication for items having the same title, for all search results except Author Keyword searches, and
- authors A-Z in ascending alphabetical order then titles A-Z in ascending alphabetical order for items having the same author, for the search results of Author Keyword (1003) searches.
If the results of the search return more than 5000 items, no sorting will be performed and the items will appear in the same order that they are stored in the database.
- STEP 11.
- Save your changes to the Sort file and, if necessary, add a reference to the Sort File using the "/S (capital S)" argument to the Zserver program. For example,
zdaemon /sOrac /pServalan /uAvon /dLiberator /Ssort.txt
The arguments for the Zserver are normally specified in the "zdaemon.arg" file.
- STEP 12.
- Restart the Zserver.
Any time you make a change to the Sort File, or any arguments to the Zserver program, the changes will not be enabled until the Zserver is re-started.
- On a UNIX platform this can be done by killing the zdaemon process (sometimes the "./zkill" command is available), and then running the "./zrun" or "./runz" command from the zserver directory.
- On a windows platform the zserver is usually a service available in the Control Panel which can be stopped and started by a click of the mouse.