C   28/05/82 504230959  MEMBER NAME  MUCHAN   (JADEMUS)     FORTRAN
C   28/05/82 504221732  MEMBER NAME  MUCHAN2  (MUCALIB.S)   FORTRAN
C   28/05/82 504211226  MEMBER NAME  MUCHAN   (JADEMUS)     FORTRAN
C   27/05/82 205271455  MEMBER NAME  MUCHAN   (S)           FORTRAN
C   27/10/81 110271013  MEMBER NAME  MUCHAN   (JADEMUS1)    FORTRAN
C   12/06/81 110261518  MEMBER NAME  MUCHAN   (S)           FORTRAN
C
C LAST CHANGE 14.50 22/04/85 P. WARMING   - CTLO/CTHI HANDLING IMPROVED
C                                          FOR UPDATE MODE, ONLY THE
C                                          CHANGED VALUES ARE STORED.
C      CHANGE 11.40 29/06/82 HUGH MCCANN  - ADD /CMUED/ .
C      CHANGE 10.00 28/05/82 HUGH MCCANN  - REDUCE CORE REQUIREMENTS FOR
C                                          PRODUCTION OF UPDATE DATASETS
C      CHANGE 10.15  27/10/81   HUGH MCCANN  -CORRECT HVDRFT BUG.
C
C
C*********************************************************************
C  THIS ROUTINE CHECKS WHETHER LOCATION NHMUCA HAS BEEN CHANGED BY
C  A PREVIOUS EDIT ( IN THE CURRENT SET ).
C  IF SO , LOCEDT IS SET TO THE LOCATION OF THE PREVIOUS CHANGED
C  VALUE IN HUPDAT.
C  THEN HUPDAT(LOCHAN) IS SET TO THE NEW VALUE OF HMUCAL(NHMUCA).
C
C  ONLY ACCEPT IALPH=6 (CTLO) OR IALPH=7 (CTHI) CHANGES IF ONE OR
C  MORE HALF-WORDS IN THE RANGE OF LOCATIONS 1907-2540 ( INC. )
C  HAVE CHANGED ( I.E. IF AND ONLY IF ONE OR MORE CTW'S HAVE CHANGED.)
C***********************************************************************
C
      SUBROUTINE MUCHAN(I)
C
C
      IMPLICIT INTEGER*2 (H)
C
C     COMMONS:
#include "cmucalib.for"
#include "cmuedwrk.for"
#include "cmued.for"
C
      DIMENSION HPOINT(21)
      DATA HPOINT/  33,1415,1497,1579,1661,1743,1825,2541,1907,
     *    3175,3176,3810,4444,7615,8249,8255,8261,8267,8273, 1907,1497/
C     COMMENTS:   OVAL,DIST, ANG,CLLO,CLHI,CTLO,CTHI, CTW,  D1,
C          VDR, DTP, LTP, LSF,MCST,BLLO,BLHI,BTLO,BTHI,BNLM, ACTW,AANG/
C
      INTEGER*2 HCHFST(83)
     *           /1,22,28,34,40,46,52,58,64,70,76,82,88,94,115,121,127,
     *     133,139,145,151,157,163,169,175,181,187,195,203,210,217,224,
     *     231,238,245,252,259,267,275,281,287,293,299,305,311,317,323,
     *     329,335,341,347,353,359,365,371,377,383,389,395,401,407,413,
     *     419,425,431,437,443,455,467,479,491,503,515,527,539,551,563,
     *     575,587,599,611,623,635/
C     COMMENT: NUMBER OF FIRST CHAMBER IN EACH FRAME.
C
C-----------------------------------------------------------------------
      IF(IALPH.NE.6.AND.IALPH.NE.7)GO TO 20
      IF(IALPH.EQ.7)RETURN
      IF(NCHAN.EQ.0)RETURN
C
      IF (HAC(1).EQ.1 .AND. HAL(1).NE.0) GOTO 11
      IF (NFRAMS.NE.82) WRITE(6,7701) NFRAMS
 7701 FORMAT(/' ++++++++++++ ATTENTION ++++++++++++++ IN S/R MUCHAN',
     *        ' VARIABLE NFRAMS.NE.82 BUT SET TO 82 <--------------'/)
      NFRAMS = 82
      DO 10 K=1,NFRAMS
         HAC(K) = HCHFST(K)
         HAL(K) = HCHFST(K+1) - 1
   10 CONTINUE
C
   11 CONTINUE
      LOCHAN = NCHAN
      DO 15 J=1,LOCHAN
         IF(HLOC(J).LE.1906 .OR. HLOC(J).GE.2541) GO TO 15
         DO 14 K=1,NFRAMS
            IF (HLOC(J)-1906.EQ.HAC(K)) GOTO 12
            IF (HLOC(J)-1906.EQ.HAL(K)) GOTO 13
            GOTO 14
   12       HCTLO(K) = HUPDAT(J) - 150
            NCHAN  = NCHAN + 1
            NHMUCA = HPOINT(6)-1 + K
            HLOC(NCHAN)  = NHMUCA
            HUPDAT(NCHAN)= HCTLO(K)
CCCCC       WRITE(6,9991)J,HLOC(J),HUPDAT(J), NCHAN,NHMUCA,HUPDAT(NCHAN)
C9991       FORMAT(' CHECK CTLO: J,LOC,CTW, NEW J,LOC,CTLO:',6I6)
            GOTO 14
   13       HCTHI(K) = HUPDAT(J) + 150
            NCHAN  = NCHAN + 1
            NHMUCA = HPOINT(7)-1 + K
            HLOC(NCHAN)  = NHMUCA
            HUPDAT(NCHAN)= HCTHI(K)
CCCCC       WRITE(6,9992)J,HLOC(J),HUPDAT(J), NCHAN,NHMUCA,HUPDAT(NCHAN)
C9992       FORMAT(' CHECK CTHI: J,LOC,CTW, NEW J,LOC,CTHI:',6I6)
            GOTO 14
   14    CONTINUE
   15 CONTINUE
      RETURN
C
   20 NCHAN=NCHAN+1
      LOCHAN=NCHAN
      NHMUCA=HPOINT(IALPH)+I-1
      IF(NCHAN.EQ.1)GO TO 3002
      JEND = NCHAN-1
      DO 3001 J=1,JEND
      IF(HLOC(J).NE.NHMUCA) GO TO 3001
      LOCHAN=J
      NCHAN=NCHAN-1
      GO TO 3002
 3001 CONTINUE
 3002 HUPDAT(LOCHAN)=HMUCAL(NHMUCA)
      HLOC(LOCHAN)=NHMUCA
      RETURN
      END
C
      BLOCK DATA
C
      IMPLICIT INTEGER*2 (H)
C
C
#include "cmued.for"
C
      DATA NCHAN/0/
      END
