C******************** START FILE UFSCOR.FOR ; GROUP UFILS0 ******************
C-----------------------------------------------------------------
C  UFSCOR
C  CALCULATE KEYWORD ALPHABETIC ORDER
C
      SUBROUTINE UFSCOR(NSC,SCLAB,IORDER)
C
      USE UFILES
C
      CHARACTER*30 SCLAB(NSC)
      INTEGER IORDER(*)
C
C  KEYWORD FOR JTH SCALAR IN SCLAB(J)
C
      IORDER(1)=1
      IF(NSC.LE.1) RETURN
C
      DO 10 ISC=2,NSC
C  LOCATE ALPHABETIC POSITION OF NEXT ENTRY
        ILOC=IUFSLO(SCLAB(ISC)(1:10),ISC-1,SCLAB,IORDER,IEQ)
C  IF EQUALS FLAG IS SET THERE IS A DUPLICATE KEYWORD-- FATAL ERROR
        IF(IEQ.EQ.1) GO TO 9000
C  INSERT ENTRY IN ORDER ARRAY
        CALL UFSCIN(ILOC,ISC-1,NSC,IORDER)
 10   CONTINUE
      RETURN
C  FATAL ERROR
 9000 CONTINUE
      WRITE(UFELUN,9001) SCLAB(ISC)
 9001 FORMAT(' ? UFSCOR FATAL ERROR-- DUPLICATE KEYWORD:  "',A,'"'/
     >         '   UF0RDR ERROR CHECKING FAILED')
      call bad_exit
      END
C******************** END FILE UFSCOR.FOR ; GROUP UFILS0 ******************
