      subroutine bocohsub2(hh,im,jm)

      implicit none
      integer::im,jm,i,j,n,i1,j1,ks1,ks2
      integer,parameter::nm=14
      real,dimension(0:im+1,0:jm+1,nm,4,4)::hh
      real,dimension(:,:,:),allocatable::hhv

      allocate(hhv(-5:4*im+3,-5:4*jm+3,nm))
      do n=1,nm
      do i=1,im
      do j=1,jm
      do ks1=1,4
      do ks2=1,4
       i1=(i-1)*4+ks1-2
       j1=(j-1)*4+ks2-2
       hhv(i1,j1,n)=hh(i,j,n,ks1,ks2)
      enddo
      enddo
      enddo
      enddo
      enddo

      call bocov2(hhv,4*im-3,4*jm-3)

      do n=1,nm
      do i=0,im+1
      do j=0,jm+1
      do ks1=1,4
      do ks2=1,4
       i1=(i-1)*4+ks1-2
       j1=(j-1)*4+ks2-2
       hh(i,j,n,ks1,ks2)=hhv(i1,j1,n)
      enddo
      enddo
      enddo
      enddo
      enddo
      deallocate(hhv)

      end subroutine bocohsub2

