C C Subroutine SORT sorts array WORD using C a simple exchange sort (sinking sort). The array IS put in C ascending order based on the DATE field of WORD which consists of C five characters starting at position 29 of each word. C LEN is the number of entries in the array. C SUBROUTINE SORT (WORD, LEN) CHARACTER*35 WORD(1000), TWORD INTEGER LEN INTEGER J, K LOGICAL EXCH J = 1 13 EXCH = .FALSE. C C Loop to do one pass over the array, exchanging adjacent entries C as necessary. C DO 11 K = 1, LEN - J IF (WORD(K)(29:33) .GT. WORD(K+1)(29:33)) THEN TWORD = WORD(K) WORD(K) = WORD(K+1) WORD(K+1) = TWORD EXCH = .TRUE. ENDIF 11 CONTINUE J = J + 1 C C Determine if another pass is needed C IF (EXCH) GO TO 13 RETURN END