MODULE CPL_INT_MOD
CONTAINS
SUBROUTINE CPL_INT(PGTF,KENDROWL,KFIELDS,KFFIELDS,KLEN,KSTA,CPL_PROC,KPTRGP)

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

IMPLICIT NONE
INTEGER(KIND=JPIM), INTENT(IN) :: KENDROWL 
INTEGER(KIND=JPIM), INTENT(IN) :: KFIELDS
INTEGER(KIND=JPIM), INTENT(IN) :: KFFIELDS
INTEGER(KIND=JPIM), INTENT(IN) :: KLEN
INTEGER(KIND=JPIM), INTENT(IN) :: KSTA(KENDROWL)
INTEGER(KIND=JPIM), OPTIONAL, INTENT(IN) :: KPTRGP(:)
REAL(KIND=JPRB), INTENT(INOUT) :: PGTF(KFIELDS,KLEN)
EXTERNAL  CPL_PROC

INTEGER(KIND=JPIM) :: IPTRGP(KFIELDS)
INTEGER(KIND=JPIM) :: J
REAL(KIND=JPHOOK) :: ZHOOK_HANDLE
!--------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('CPL_INT_MOD:CPL_INT',0,ZHOOK_HANDLE)
IF(PRESENT(KPTRGP)) THEN
  IPTRGP(:)=KPTRGP(1:KFIELDS)
ELSE
  DO J=1,KFIELDS
    IPTRGP(J)=J
  ENDDO
ENDIF
CALL CPL_PROC(PGTF,KENDROWL,KFIELDS,KFFIELDS,KLEN,KSTA,IPTRGP)
IF (LHOOK) CALL DR_HOOK('CPL_INT_MOD:CPL_INT',1,ZHOOK_HANDLE)
END SUBROUTINE CPL_INT
END MODULE CPL_INT_MOD
