      SUBROUTINE CHECK(IAORDS,ISOM,ICHSO,ISOR,ISOC,JAOR)
C
C     CHECK WHETHER IT SI A NEW REDUCTION SET AND COPY IT TO DUMP
C
C     IAORDS ..... CURRENT AO REDUCTION SET
C     INFO(1,I) .. START ADRESS-1 OF I'TH REDUCTION SET
C     INFO(I,2) .. DIMENSIONS #ROWS = # OF SO'S
C     INFO(I,3) .. DIMENSIONS #COLUMNS = # OF AO'S
C
      IMPLICIT INTEGER (A-Z)
C
      DIMENSION ICHSO(ISOR),ISOM(ISOR,ISOC)
      COMMON/WORK/  IDUM(10000),INFO(100,3)
C
      INFO(1,1)=0
C
C     IF NEW REDUCTION SET IS GENERATED
C     DUMP INFORMATION ON IDUM.
C
      IADR=INFO(IAORDS,1)
      INFO(IAORDS+1,1)=ISOR*(ISOC+1)+IADR
      INFO(IAORDS,2) = ISOR
      INFO(IAORDS,3) = ISOC
      DO 110 I=1,ISOR
         IADR=IADR+1
         IDUM(IADR) = ICHSO(I)
 110  CONTINUE
      DO 130 J=1,ISOR
         DO 120 I=1,ISOC
            IADR=IADR+1
            IDUM(IADR)=ISOM(J,I)
 120     CONTINUE
 130  CONTINUE
C
C     COMPARE IF AORDS OCCURS ALREADY.
C
      JJ=IAORDS-1
      IF(JJ.LT.1) GO TO 175
      DO 170 JAORDS=1,JJ
         LAOR=JAORDS
         IF(INFO(JAORDS,2).NE.INFO(IAORDS,2).OR.
     1      INFO(JAORDS,3).NE.INFO(IAORDS,3)) GO TO 170
         DO 140 I=1,ISOR
            IADDR=INFO(JAORDS,1)+I
            IADR=INFO(IAORDS,1)
            IF(IDUM(IADDR).NE.IDUM(IADR+I))GO TO 170
 140     CONTINUE
         DO 160 J=1,ISOR
            IADDR=INFO(JAORDS,1)+ISOR+ISOC*(J-1)
            DO 150 I=1,ISOC
               IF(IDUM(IADDR+I).NE.
     1            ISOM(J,I)) GO TO 170
 150        CONTINUE
 160     CONTINUE
         GO TO 180
 170  CONTINUE
 175  JAOR=IAORDS
      RETURN
 180  CONTINUE
      IAORDS=IAORDS-1
      JAOR=LAOR
      RETURN
      END
