DOC SORT - Sort Document file

(4/26/12)

PURPOSE

Sorts a document file, in either ascending or descending order, according to values found in a chosen column.   Example.

SEE ALSO

DOC CREATE [Create Document file]
DOC MERGE [Merge two Document files]
DOC MIRROR [Mirror a Document file]
DOC REN [Renumber Document file keys]
DOC SHUFFLE [Shuffle Document file]
DOC SUBTRACT [Subtract two Document files]
AT IT [Automatic particle picking - sort doc file]
SD [Save Document]

USAGE

.OPERATION: DOC SORT
   <or>
DOC SORT A
['DOC SORT A' appends the sorted output to end of existing output file while 'DOC SORT' overwrites an existing output file. ]

.INPUT DOCUMENT FILE: DOC001
[Enter name of input document file.]

.OUTPUT DOCUMENT FILE: DOC002
[Enter name of output document file.]

.COLUMN TO BE SORTED BY (0 IS KEY) (<0 TO REVERSE): 1
[Enter column number according to which the file will be sorted. If column is less than zero then the sort is in descending order. ]

.COMPRESS & RENUMBER KEYS? (Y/N), REMOVE DUPLICATES (Y/N): Y Y
[If the compress answer is 'Y' then keys are renumbered consecutively beginning with key 1.
If the compress answer is 'N' the original keys are kept and they may not be consecutive.
If the remove duplicates answer is 'Y' then any duplicate values in the sort column are replaced by the first duplicated value.
If the remove duplicates answer is 'N' then any duplicate values in the sort column are are kept.]

NOTES

  1. Any data stored under a duplicate key is lost. If you want to keep data stored under duplicate keys use "DOC RENUMBER' first.

  2. A descending sort on keys (column = 0) is not supported.

SUBROUTINES

DOCS1, OPENDOC, LUNDOC, SORT

CALLER

DRIV1