SUBROUTINE ONEDVAR_RAINTB_HLD(KHLPRDY,KT)
!****-------------------------------------------------------------------
!**** *ONEDVAR_RAINTB_HLD* - ONEDVAR LOAD BALANCING
!****-------------------------------------------------------------------
!     Purpose.   Hold EC_PHYS_DRV until all Helper Signals Received
!     --------

!**   Interface.
!     ----------

!        Explicit arguments :  KHLPRDY,KT
!        --------------------

!     Method.
!     -------
!       Called by EC_PHYS_DRV

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

!     Author.
!     -------
!        John Hague   *ECMWF* 22-Nov-2005

!     Modifications.
!     --------------
!     ------------------------------------------------------------------

USE PARKIND1  , ONLY : JPIM     ,JPRB
USE YOMHOOK   , ONLY : LHOOK    ,DR_HOOK
USE YOM_PTR_SSMI , ONLY : LERAIN_ACTIVE
USE YOMRAIN_LB , ONLY : ICOPROCS, CLPROC, JPHLP
USE MPL_MODULE , ONLY : MPL_RECV

IMPLICIT NONE

INTEGER(KIND=JPIM), INTENT(INOUT)  :: KHLPRDY(JPHLP+1)
INTEGER(KIND=JPIM), INTENT(IN)     :: KT

REAL(KIND=JPRB)    :: ZBUF
INTEGER(KIND=JPIM) :: J
REAL(KIND=JPRB)    :: ZHOOK_HANDLE

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


IF(LERAIN_ACTIVE) THEN
  IF(CLPROC == "M") THEN
    !-------MASTER: Hold until all Helper Signals Received
    DO J= 1,ICOPROCS(1)
      IF(KHLPRDY(J+1) == 0 ) THEN
        CALL MPL_RECV(ZBUF,KTAG=KT,KSOURCE=ICOPROCS(J+1),CDSTRING='ONEDVAR_RAINTB_HLD:')
      ENDIF
    ENDDO
  ENDIF
ENDIF

IF (LHOOK) CALL DR_HOOK('ONEDVAR_RAINTB_HLD',1,ZHOOK_HANDLE)

END SUBROUTINE ONEDVAR_RAINTB_HLD
