      SUBROUTINE YRJDAY(CENDAY, YEAR, JULDAY)
C
C***********************************************************************
C    NAME- YRJDAY
C
C    LANGUAGE- FORTRAN 77     TYPE- SUBROUTINE   COMPUTER- CRAY   
C
C    VERSION- 1.0     DATE- 03/11/91   PROGRAMMER- CARLA NEIGH(SMSRC)
C    VERSION- 3.0     DATE- 04/15/96   PROGRAMMER- ALEX POZDNYAK(FDC)
C      MODIFIED TO RUN ON THE CRAY.  REPLACED I*4 WITH INT.
C  
C    FUNCTION- THIS SUBROUTINE COMPUTES YEAR AND JULIAN DAY, GIVEN
C              THE CENTURY DAY.
C
C    CALLING SEQUENCES-
C      VARIABLE   TYPE  I/O  DESCRIPTION
C      --------   ----  ---  -----------
C      CENDAY      INT   I   DAY OF CENTURY (FROM 1900)
C      YEAR        INT   O   YEAR (00-99)
C      JULDAY      INT   O   JULIAN DAY
C
C    LOCAL VARIABLES-
C      VARIABLE    TYPE   DESCRIPTION
C      --------    ----   -----------
C      CDAY         INT   EQUALS INPUT VALUE OF CENDAY IF CENDAY IS
C                         FROM 20TH CENTURY, OTHERWISE IS CENTURY DAY
C                         FROM START OF 21ST CENTURY
C      NLEAPS       INT   NUMBER OF LEAP YEARS OCCURING BEFORE YEAR
C                         IN CENTURY FOR WHICH YEAR AND JULDAY ARE
C                         COMPUTED
C
C    COMMENTS- THIS SUBROUTINE IS VALID FOR DATES JAN 1, 1956 THROUGH
C              DECEMBER 31, 2055
C
C***********************************************************************
C
      INTEGER  CENDAY, YEAR, JULDAY
      INTEGER  CDAY, NLEAPS
C
      INCLUDE 'SPVAL'
C
C  INITIALIZE YEAR AND JULDAY TO MISSING VALUES.
C
      YEAR = I4SPV
      JULDAY = I4SPV
C
C  CALCULATE THE YEAR SINCE 1900.  IF THE YEAR EXTENDS INTO THE 21ST
C  CENTURY, MODIFY THE VALUE OF YEAR TO FIT THE 0-99 FORMAT.
C
      YEAR = CENDAY / 365.25
C
      IF (YEAR.GE.100) YEAR = YEAR - 100
C
C  IF THE VALUE OF CENTURY DAY EXTENDS US INTO THE 21ST CENTURY, MODIFY
C  CENDAY TO BE THE CENTURY DAY SINCE THE BEGINNING OF YEAR 2000.
C
      IF (CENDAY .GT. 36524) THEN
         CDAY = CENDAY - 36524
      ELSE
         CDAY = CENDAY
      ENDIF
C
C  CALCULATE NUMBER OF LEAP YEARS IN THE CENTURY OCCURING BEFORE YEAR.
C  20TH CENTURY IS ASSUMED FOR YEAR = 56 OR GREATER, OTHERWISE 21ST
C  CENTURY IS ASSUMED.
C
      IF (YEAR.GE.56) THEN
        NLEAPS = (YEAR-1)/4
      ELSE
        IF (YEAR.GT.0) THEN
          NLEAPS = (YEAR-1)/4 + 1
        ELSE
          NLEAPS = 0
        ENDIF
      ENDIF
C
C  CALCULATE THE JULIAN DAY.
C
      JULDAY = CDAY - (YEAR * 365 + NLEAPS)
C
      RETURN
      END
