*     ************************************************************************

      subroutine setdbl( val, part, i )

*     ************************************************************************

*     Purpose :
*     ---------

*     This routine sets the integer value VAL in the
*     left or the right part of the integer I.

*     The two parts of the integer I are limited to 99999.

*     Parameters :
*     ------------

*     val     ( int )

*       input  : integer value to set in the left or
*                the right part of the integer I.
*       output : unmodified.

*     part    ( int )

*       input  : = 1 : VAL is set in the left  part of I.
*                = 2 : VAL is set in the right part of I.
*       output : unmodified.

*     i       ( int )

*       input  : arbitrary integer.
*       output : the same integer who has the value VAL in its
*                left or right part.

*     Routines used :
*     ---------------

*     abs,sign.

*     Programming :
*     -------------

*     D. Tuyttens

*     ========================================================================

*     Routine parameters

      integer   val, part, i

*     Internal variables

      integer   par1, par2, maxcy
      parameter ( maxcy = 10**5 )

      if( part.eq.1 ) then
        par1 = i/maxcy
        par2 = mod(i,maxcy)
        i    = sign(1,val)*(abs(val)*maxcy+par2)
      else
        i    = sign(1,i)*((abs((i/maxcy))*maxcy)+val)
      endif

      return
      end