! -------------------------------------------------------------
      subroutine x_sdat_c(msgtype,istat,nproc,tids)
! -------------------------------------------------------------
      use x_gdat
    
      implicit none

      include 'fpvm3.h'
      integer :: i,j,k
      integer :: info
      integer :: istat
      integer :: msgtype
      integer :: nproc
      integer, dimension(0:32) :: tids

      external fbuff

      do i= 1,nproc
         j= 1+snd_c*(i-1)
         write(1,*) 'i=',i,' j=',j
         call fbuff()
         call pvmfinitsend( PVMDEFAULT, info )
         call pvmfpack( INTEGER4, istat, 1, 1, info )
         if(istat.ne.0) then
           call pvmfpack( integer4, snd_c, 1, 1, info )
           call pvmfpack( real8, r8_frm_p(j), snd_c, 1, info )
         endif
         call pvmfsend( tids(i-1), msgtype, info )
      enddo

      end
