AEh XF$SORT sort a data file
Input X register - Points to filename to be sorted.
D register - Address of routine to call during sorting.
Output - none -
Description

Sorts the file pointed to by the X register.

The filename at X is a leading byte count string of the form "A:NAME" (only files on A can be sorted).

The D register should point to a subroutine which will be called during the sort (usually used to print to the screen). When the routine is called the A register will contain the 'pass' number (1,2,3) and the X register will contain the record number/number of comparisons, during the sort. If no routine is required, set D to 0000.

The method used is a Quick Sort algorithm which can be used as a general sort (see UT$SORT). The 3 passes are as follows:

  1. Generate the tag list
  2. Sort the tag list
  3. Re-construct the file from the sorted tag list

The total number of bytes in RAM required to sort a file of size S bytes and containing N records is approximately given by the following formula:

Space required = 2 * ( S + N )

If there is insuffient memory for the sort, the file will left alone and the error 254 will be returned.

This call is not available on CM/XP machines.

Example
example
Errors 194 - battery too low
200 - read pack err
234 - file not found
236 - bad file name
245 - write pack err
254 - Not enough room for the sort