CHR_SORT

Sort an array of character variables into alphabetical order

Description:

Sort an array of character variables into alphabetical order using the collating sequence provided by the routine CHR_SCOMP. After the sort, a search is made to remove any values which occur more than once. The total number of unique values is returned.

Invocation

CALL CHR_SORT( CHR_SCOMP, MXARY, ARRAY, NSORT )

Arguments

CHR_SCOMP = LOGICAL FUNCTION (Given)
An external function which compares two character strings and returns whether the first string is less than the second.
MXARY = INTEGER (Given)
The number of character values to sort.
ARRAY( MXARY ) = CHARACTER ( ) (Given and Returned)
The array of character values to be sorted.
NSORT = INTEGER (Returned)
The number of unique character values returned.

Notes:

To use this subroutine it is necessary to declare the function CHR_SCOMP, or its equivalent, to be EXTERNAL in the calling routine.