SUBROUTINE RD801

!**** *RD801*  - reads in the inputs for sensitivity job 801

!     Purpose.
!     --------
!     Read in the input files for sensitivity analysis

!**   Interface.
!     ----------
!        *CALL* *RD801

!        Implicit arguments :      The state variables of the model
!        --------------------

!     Method.
!     -------
!        See documentation

!     Externals.
!     ----------

!     Reference.
!     ----------
!        ECMWF Research Department documentation of the IFS

!     Author.
!     -------
!        Florence Rabier  *ECMWF*

!     Modifications.
!     --------------
!        Original : 93-10-12
!        Modified : 94-03-18 L.Labbe : Orography as dummy argument
!        Modified : 95-06-06 L.Isaksen   Reordering of spectral arrays
!        M. Hamrud  :  95-10-01 - Interface block for SUSPEC
!        E. Holm    :  97-11-28 - Call to SUSPEC changed (incl. ozone)
!        L. Dragulanescu : 97-05-23 - 3DVAR ALADIN
!        R. El Khatib : 98-04-02 - Cleanup 3DVAR ALADIN
!        P.Smolikova  : 02-09-30 - Interface to SUSPEC for d4 in NH
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        M.Hamrud      10-Jan-2004 CY28R1 Cleaning
!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPRB     , JPIM
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
USE YOMCT0   , ONLY : LELAM
USE YOMSP    , ONLY : SP5A3,SP5A2,SP5A1
USE YOMSPJB  , ONLY : SP7A3,SP7A2,SP7A1
USE YOMVAR   , ONLY : LTRREF
USE YOMLUN   , ONLY : NULOUT
USE YOMVRTL  , ONLY : L801TL

IMPLICIT NONE

REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "add3to5.intfb.h"
#include "suspec.intfb.h"
#include "suespe0.intfb.h"
#include "suspe0.intfb.h"

!     ------------------------------------------------------------------

!*       1.    READ ACCORDING TO LTRREF THE INPUT FILES
!              ----------------------------------------

IF (LHOOK) CALL DR_HOOK('RD801',0,ZHOOK_HANDLE)
IF (LTRREF) THEN
  WRITE(NULOUT,*) 'RD801:reading the ICMRF file into spa7 (LTRREF=.T.)'
  CALL SUSPEC(SP7A3,SP7A2,SP7A1,KFILE=2 )
ELSE
  WRITE(NULOUT,*) 'RD801:reading the ICMSHINIT file into spa5 (LTRREF=.T.)'
  WRITE(NULOUT,*) '      and adding spa5=spa5+spa3=forecast+perturb'
  CALL SUSPEC(SP5A3,SP5A2,SP5A1,KFILE=0)
  IF(L801TL) THEN
    CALL ADD3TO5
    CALL SUSPE0
    IF (LELAM) THEN
      CALL SUESPE0
    ENDIF
  ENDIF
ENDIF

!     ------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('RD801',1,ZHOOK_HANDLE)
END SUBROUTINE RD801
