SUBROUTINE CX_SORT ( nmdesc, mxdatv, expdesc, nsdcr, + sortdesc, iret ) C************************************************************************ C* CX_EXPD * C* * C* This subroutine sorts in ascending order the element descriptors in * C* the array expdesc. The sort is unique with duplicate descriptors * C* removed. * C* * C* CX_SORT ( NMDESC, MXDATV, EXPDESC, NSDCR, SORTDESC, IRET ) * C* * C* * C* Input parameters: * C* NMDESC INTEGER Number of descriptors in expdesc* C* MXDATV INTEGER Maximum number of data values * C* expected * C* * C* EXPDESC (MXDATV) * C* CHAR* Expanded list of descriptors * C* * C* Output parameters: * C* NSDCR INTEGER Number of sorted descriptors in * C* array sortdesc * C* SORTDESC CHAR* Sorted list of the unique * C* element descriptors in expdesc * C* IRET INTEGER Return code * C* 0 = normal return * C* 1 = fatal error * C* * C** * C* Log: * C* R. Hollern/NCEP 8/03 * C************************************************************************ INCLUDE 'cxcmn.cmn' C* CHARACTER idc*6, itemp*6 CHARACTER iwork(100)*6 CHARACTER sortdesc ( mxdatv )*6 CHARACTER expdesc ( mxdatv )*6 C----------------------------------------------------------------------- iret = 0 itype = 2 C C* The descriptors in array expdesc will be sorted in ascending C* order, unique only (itype = 2). C CALL ST_SORT ( itype, nmdesc, expdesc, nsdcr, sortdesc, iret ) C C* Remove the non- element descriptors from sortdesc. C j = 0 C DO i = 1, nsdcr itemp = sortdesc ( i ) IF ( itemp(1:1) .ne. 'B' ) THEN ELSE j = j + 1 sortdesc ( j ) = itemp END IF END DO C nsdcr = j C* RETURN END