      FUNCTION IYMDJL (IYR,IMON,IDAY)
C
C     CONVERT FROM INTEGER IYR IMON IDAY DATE TO DAY COUNT
C
C     ASSUME AT LEAST 20 BIT INTEGER
C     USE BASE AS  1900 (01 JAN 1900 IS DAY 1)
C
      INTEGER*4 IBASE, IYMDJL                                           ML
      INTEGER NDAY(12)
C
      DATA NDAY /0,31,59,90,120,151,181,212,243,273,304,334/
      DATA IBASE /693960/
C
      NYR=IYR
      IF (NYR.LT.100) NYR = NYR + 1900
      JYR=NYR-1
      NLEAP=JYR/4+JYR/400-JYR/100
C
      MLEAP=0
      IF (IMON.GE.3) THEN
      IF (MOD(NYR,4).EQ.0 .AND. (MOD(NYR,100).NE.0 .OR. (MOD(NYR,100)
     .    .EQ.0 .AND. MOD(NYR,400).EQ.0))) MLEAP=1
      ENDIF
      IF ((IMON.LE.0).OR.(IMON.GE.13)) THEN
      IYMDJL = -777777
      ELSE
      IYMDJL=NYR*365+NLEAP+NDAY(IMON)+IDAY+MLEAP-IBASE                  Hlg
C     IYMDJL=NYR*INT4(365)+NLEAP+NDAY(IMON)+IDAY+MLEAP-IBASE            ML
      ENDIF
C
      RETURN
      END
