SUBROUTINE GPGETTEND(LDFIRST,KST,KEND,PEXTRA,KLEVX,KFLDX,&
 & PUP9,PVP9,PTP9)  

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOMDIM   , ONLY : NFLEVG   ,NPROMA 

!**** *GPGETTEND - get dynam. tendencies from extra fields buffer

!     Purpose. get dynam. tendencies in extra fields buffer
!     -------- 

!**   Interface.
!     ----------
!        *CALL* *GPGETTEND(...)*

!        Explicit arguments : see CPGLAG, all names the same
!        -------------------- except for DOCTOR norm modifications

!        Implicit arguments :
!        --------------------

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

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

!     Reference.
!     ----------
!        None

!     Author.
!     -------
!        Nils Wedi  *ECMWF*

!     Modifications.
!     --------------
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!     ------------------------------------------------------------------

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KLEVX 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLDX 
LOGICAL           ,INTENT(IN)    :: LDFIRST 
INTEGER(KIND=JPIM),INTENT(IN)    :: KST 
INTEGER(KIND=JPIM),INTENT(IN)    :: KEND 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PEXTRA(NPROMA,KLEVX,KFLDX) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PUP9(NPROMA,KLEVX) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PVP9(NPROMA,KLEVX) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTP9(NPROMA,KLEVX) 

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

INTEGER(KIND=JPIM) ::  IFLD
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

#include "abor1.intfb.h"

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

IF (LHOOK) CALL DR_HOOK('GPGETTEND',0,ZHOOK_HANDLE)

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

IF( KLEVX /= NFLEVG ) THEN
  CALL ABOR1('GPGETTEND: KLEVX /= NFLEVG')
ENDIF

IF(.NOT.LDFIRST) THEN
  IFLD=1
  PUP9(KST:KEND,1:KLEVX)=PEXTRA(KST:KEND,1:KLEVX,IFLD)
  IFLD=IFLD+1
  PVP9(KST:KEND,1:KLEVX)=PEXTRA(KST:KEND,1:KLEVX,IFLD)
  IFLD=IFLD+1
  PTP9(KST:KEND,1:KLEVX)=PEXTRA(KST:KEND,1:KLEVX,IFLD)
  IFLD=IFLD+1
ENDIF

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

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