      SUBROUTINE SAVING9(LSSP,LSGG,LSRAD,LSBEG,LSTR,LSHF,LCSW,LCLW,
     1                   LSCOSP,
     2                   ISSP,ISGG,ISRAD,ISBEG,ISTR,ISHF,ICSW,ICLW,
     3                   ISCOSP,ISST,
     4                   LSDAY,LS3HR,LSST,DELT,NDAYS,NSECS)
C
C     * MAR 22/19 - J. COLE    ADD "LSST/ISST" TO SAVE SITE DATA
C     * NOV 03/18 - M.LAZARE.  ADD "LS3HR" FOR CMIP6 DATA OUTPUT.
C     * APR 25/10 - J.COLE.    NEW VERSION FOR GCM15I:
C     *                        - ADD ISCOSP/LSCOSP FOR COSP SIMULATOR.
C     * DEC 03/07 - L.SOLHEIM/ PREVIOUS VERSION SAVING8 FOR GCM15G/H:
C     *             M.LAZARE.  - CALLS REVISED SAVINGX INSTEAD OF SAVING.
C     *                        - IMPLICIT NONE IMPOSED WITH PROMOTION
C     *                          AS NECESSARY.
C     * FEB 15/05 - M.LAZARE.  PREVIOUS VERSION SAVING7 BEFORE GCM15G.
C
C     * SET LOGICAL SWITCHES FOR SAVING OR NOT THE SP,GG,BEG AND RAD FIELDS
C     * ALSO TO SAVE CERTAIN FIELDS EVERY DAY AND POSSIBLY AT HIGHER
C     * FREQUENCY, SAVE THE TRACERS AT DIFFERENT FREQUENCIES
C     * AND COMPUTE OR NOT THE LONGWAVE AND SHORTWAVE RADIATION.
C
      IMPLICIT NONE
C
      REAL      :: DELT
      INTEGER*8 :: NUMSEC,NDAYS8,NSECS8
      INTEGER   :: NDAYS,NSECS,IDT
      INTEGER   :: ISSP,ISGG,ISRAD,ISBEG,ISDAY,ISTR,ISHF,ICSW,ICLW,
     +             IS3HR,ISCOSP,ISST
      LOGICAL   :: LSSP,LSGG,LSRAD,LSBEG,LSDAY,LSTR,LSHF,LCSW,LCLW,
     +             LS3HR,LSCOSP,LSST
      NDAYS8=NDAYS
      NSECS8=NSECS
      NUMSEC=NDAYS8*86400_8+NSECS8
      IF(NUMSEC.LT.0)            CALL XIT('SAVING9',-1)  !trap overflow
      IDT   =INT(DELT)
      ISDAY =24*INT(3600./DELT)
      IS3HR = 3*INT(3600./DELT)
C
      CALL SAVINGX(LSSP ,ISSP ,IDT,NUMSEC)
      CALL SAVINGX(LSGG ,ISGG ,IDT,NUMSEC)
      CALL SAVINGX(LSRAD,ISRAD,IDT,NUMSEC)
      CALL SAVINGX(LSDAY,ISDAY,IDT,NUMSEC)
      CALL SAVINGX(LCSW, ICSW, IDT,NUMSEC)
      CALL SAVINGX(LCLW, ICLW, IDT,NUMSEC)
      CALL SAVINGX(LSBEG,ISBEG,IDT,NUMSEC)
      CALL SAVINGX(LSTR, ISTR, IDT,NUMSEC)
      CALL SAVINGX(LSHF, ISHF, IDT,NUMSEC)
      CALL SAVINGX(LS3HR,IS3HR,IDT,NUMSEC)
      CALL SAVINGX(LSCOSP, ISCOSP, IDT,NUMSEC)
      CALL SAVINGX(LSST, ISST, IDT,NUMSEC)
C
C     * TRACER SAVING FREQUENCY MUST BE A MULTIPLE OF GENERAL
C     * SPECTRAL SAVING SO THAT DIAGNOSTIC OPERATIONS SUCH AS
C     * INTERPOLATION TO PRESSURE (THROUGH THE USE OF LNSP) WILL
C     * FUNCTION.
C
      IF(MOD(ISTR,ISSP).NE.0)            CALL XIT('SAVING9',-2)
      RETURN
      END
