*DECK CDXDAT
      SUBROUTINE CDXDAT(KCD,KD,KM,KY)
C                                      
C             THIS SUBROUTINE CONVERTS  
C             KCD       CENTURY DATE 
C             BACK TO      
C             KD        DAY 
C             KM        MONTH
C             KY        YEAR (IN THE FORM 19XX, 20XX)
C
C----------------------------------------------------------------------
C
      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 APPROXIMATE YEAR
C  NEW CODE
      IIKCD=KCD
      IKCD=KCD
      IF(KCD.GT.36524) THEN
         IKCD=KCD-36525
      ENDIF
      KY=IKCD/365
      NDAYS=MOD(IKCD,365)
C             SUBTRACT 1 DAY FOR EACH LEAP YEAR
      ILY=(KY-1)/4
      if(ky.eq.0) ily=-1
      NDAYS=NDAYS-ILY
      IF (NDAYS.GT.0) GO TO 10
C             ADD A YEAR IF NECCESSARY TO COMPENSATE FOR L.Y. DAYS
      NDAYS=NDAYS+365
      KY=KY-1
      IF (MOD(KY,4).EQ.0) NDAYS=NDAYS+1
   10 CONTINUE
C             CORRECT YEAR FOR CENTURY
      KY=KY+1900
      IF(KCD.GT.36524) KY=KY+100
C             TEST FOR CURRENT YEAR LEAP YEAR
      IF (MOD(KY,4).EQ.0) GO TO 30
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)
      RETURN
C----------------------------------------------------------------------
C             LEAP YEAR
   30 CONTINUE
      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)
C
      RETURN
      END
C     ***************************************************************
*DECK IDATXC
      FUNCTION IDATXC(KD,KM,KY)
C    
C             THIS FUNCTION RETURNS CENTURY DAY GIVEN
C             KD        DAY
C             KM        MONTH
C             KY        YEAR (19XX, 20XX OR XX)
C
C----------------------------------------------------------------------
C
      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/
      IY=MOD(KY,100)
      IYDAY=IDAYS(KM)+KD
      IF (MOD(IY,4).EQ.0) IYDAY=JDAYS(KM)+KD
      ILY=(IY-1)/4
      IF(KY.EQ.1900.OR.KY.EQ.00.OR.KY.EQ.2000) ILY=-1
      IDATXC=IY*365+ILY+IYDAY
      IF(KY.GE.2000) IDATXC=IDATXC+36525
C
      RETURN
      END
C     ***********************************************************
