*DECK CDXDAT2
      SUBROUTINE CDXDAT2000(KCD,KD,KM,KY)
C                                      
C             THIS SUBROUTINE CONVERTS  
C             KCD       DAY SINCE 1/1/1900 
C             BACK TO      
C             KD        DAY 
C             KM        MONTH
C             KY        YEAR (IN THE FORM YYYY)
C
C     Assuming all years nn00 are leap years
C     (true for 2000,2400,.. but not for 1900,2100,etc).
C----------------------------------------------------------------------
C
      INTEGER KCD,KD,KM,KY,IY
      DIMENSION IDAYS(12),JDAYS(12)
      DATA IDAYS/0,31,59,90,120,151,181,212,243,273,304,334/
      DATA JDAYS/0,31,60,91,121,152,182,213,244,274,305,335/
C             FIND CENTURY
      NDPCEN=36525
      ICEN=KCD/NDPCEN+19
      IKCD=MOD(KCD,NDPCEN)
C             ESTIMATE YEAR
      IY=IKCD/365
      NDAYS=MOD(IKCD,365)
C             SUBTRACT 1 DAY FOR EACH LEAP YEAR IN THE CENTURY
      ILY=(IY-1)/4+1
      IF (IY.EQ.0) ILY=0
      NDAYS=NDAYS-ILY
      IF (NDAYS.LE.0) THEN
C             ADD A YEAR IF NECCESSARY TO COMPENSATE FOR L.Y. DAYS
         NDAYS=NDAYS+365
         IY=IY-1
         IF (MOD(IY,4).EQ.0) NDAYS=NDAYS+1
      ENDIF
C             TEST FOR CURRENT YEAR LEAP YEAR
      IF (MOD(IY,4).EQ.0) THEN
C             LEAP YEAR
         DO 40 J=1,11
            IF (JDAYS(J+1).GE.NDAYS) GO TO 45
 40      CONTINUE    
         J=12   
 45      CONTINUE
         KM=J
         KD=NDAYS-JDAYS(J)
      ELSE
C             NON LEAP YEAR
         DO 20 J=1,11
            IF (IDAYS(J+1).GE.NDAYS) GO TO 25
 20      CONTINUE
         J=12
 25      CONTINUE
         KM=J
         KD=NDAYS-IDAYS(J)
      ENDIF
      KY=ICEN*100+IY
C
      RETURN
      END
C     ***************************************************************
*DECK IDATXC2
      FUNCTION IDATXC2000(KD,KM,KY)
C    
C             THIS FUNCTION RETURNS DAY SINCE 1/1/1900 GIVEN
C             KD        DAY
C             KM        MONTH
C             KY        YEAR (YYYY)
C
C     Assuming all years nn00 are leap years
C     (true for 2000,2400,.. but not for 1900,2100,etc).
C----------------------------------------------------------------------
C
      INTEGER KD,KM,KY,IY
      DIMENSION IDAYS(12),JDAYS(12)
      DATA IDAYS/0,31,59,90,120,151,181,212,243,273,304,334/
      DATA JDAYS/0,31,60,91,121,152,182,213,244,274,305,335/
C
      IY=MOD(KY,100)
      ICEN=KY/100
      NDPCEN=36525
      IYDAY=IDAYS(KM)+KD
      IF (MOD(IY,4).EQ.0) IYDAY=JDAYS(KM)+KD
      ILY=(IY-1)/4+1
      IF (IY.EQ.0) ILY=0
      IDATXC2000=(ICEN-19)*NDPCEN+IY*365+ILY+IYDAY
C
      RETURN
      END
C     ***********************************************************
