      subroutine snddat(m,n,nb,lda,a,work)
      integer m,n,nb,nprocs,lda,me,mypanel, panel
      integer i,j,k,jb, temp, host, iseed(4)
      real a(*), tmp1(1000), resid
      real work(*)

      call who0(nprocs,me,host)

      if (me .eq. 0) then
*     ** PUT NODE 0'S PANELS INTO THE WORK ARRAY **
         mypanel = 0
         do 20 j=1,n,nb*nprocs
      	     jb = min (n-j+1,nb)
             do 10 i=1,lda*jb
                 work(mypanel*lda*nb*nprocs+i) = a(mypanel*lda*nb+i)
   10        continue
             mypanel = mypanel + 1
   20    continue

         if (nprocs.gt.1) then

*          ** NODE 0 RECEIVES PANELS FROM OTHER NODES **

         panel = 0
         do 50 j=1,n,nb
             jb = min(n-j+1,nb)
             temp = mod(panel,nprocs)
             if( temp .ne. 0) then
               call recv0 ( work(panel*nb*lda+1), lda*jb*4, panel)
             endif
             panel = panel + 1
   50    continue

	 endif

         call printmat(work,lda,n,"    RETURNED WORK MATRIX")
         iseed(1) = 617
	 iseed(2) = 1553
	 iseed(3) = 2191
	 iseed(4) = 3771
c call matgen(a,lda,m,n,iseed,1)
c        call printmat(a,lda,n,"    ORIGINAL A MATRIX")
         call spot01 ('Lower',n,lda,work,lda,tmp1,resid)
c        call spot01 ('Lower',n,a,lda,work,lda,tmp1,resid)
         call printmat(work,lda,n,"    RETURNED LLT-A MATRIX")

         print *,"RESIDUAL = ",resid

      else

*     ** OTHER NODES SEND PANELS TO NODE 0 FOR ERROR CHECK **

         mypanel = 0
         do 250 j=1+me*nb,n,nb*nprocs
      	     jb = min (n-j+1,nb)
             call send0(a(mypanel*lda*nb+1),lda*jb*4,
     *                   mypanel*nprocs+me,0)
             mypanel = mypanel + 1
  250    continue
      endif

      return
      end
