      subroutine indx(qa,da,qb,db,h1,h2,hh1,hh2,ina,outa,crnr
     &  ,x1,x2,y1,y2,n1,n2,nn1,nn2,mma,nna,mmb,nnb)
c..... adjust depth values of "da" in nested locations                      
CC   no narr nest
      real*8 da(mma,nna),qa(mma,nna),db(mmb,nnb),qb(mmb,nnb)
      real*8 h1(n1),h2(n2),hh1(nn1),hh2(nn2),old
      real*8 x1(nna,3),x2(nna,3)
     &    ,y1(mma,3),y2(mma,3)
      integer ina(4),outa(4),crnr(4)
      crnr(1)=1
      crnr(2)=nn1
      crnr(3)=1
      crnr(4)=nn2
      i=1
      do while (h1(i).LE.hh1(1))
        i=i+1
      end do
      ina(1)=i
      i=1
      do while (h1(i).LT.hh1(nn1))
         i=i+1
      end do
      ina(2)=i-1
      i=1
      do while (h2(i).LE.hh2(1))
         i=i+1
      end do
      ina(3)=i
      i=1
      do while (h2(i).LT.hh2(nn2))
         i=i+1
      end do
      ina(4)=i-1
      i=1
      do while (hh1(i).LT.h1(ina(1)))
       i=i+1
      end do
      outa(1)=i
      i=1
      do while (hh1(i).LE.h1(ina(2)).AND.i.LE.nn1)
       i=i+1
      end do
      outa(2)=i-1
      i=1
      do while (hh2(i).LT.h2(ina(3)))
       i=i+1
      end do
      outa(3)=i
      i=1
      do while (hh2(i).LE.h2(ina(4)).AND.i.LE.nn2)
       i=i+1
      end do
      outa(4)=i-1
      call bounds(qb,db,qb,db,hh1,hh2,h1,h2,x1,x2,y1
     &  ,y2,ina,outa,nn1,nn2,n1,n2,mma,nna,mmb,nnb)
      do i=ina(3),ina(4)
         old=da(ina(1),i)
C         da(ina(1),i)=x1(i,1)    
C         qa(ina(1),i)=qa(ina(1),i)-old+da(ina(1),i)
         x1(i,1)=0.
         x1(i,2)=0.
         x1(i,3)=0.
         old=da(ina(2),i)
C         da(ina(2),i)=x2(i,1)
C         qa(ina(2),i)=qa(ina(2),i)-old+da(ina(2),i)
         x2(i,1)=0.
         x2(i,2)=0.
         x2(i,3)=0.
      end do
      do i=ina(1),ina(2)
         old=da(i,ina(3))
C         da(i,ina(3))=y1(i,1)
C         qa(i,ina(3))=qa(i,ina(3))-old+da(i,ina(3))
         y1(i,1)=0.
         y1(i,2)=0.
         y1(i,3)=0.
         old=da(i,ina(4))
C         da(i,ina(4))=y2(i,1)
C         qa(i,ina(4))=qa(i,ina(4))-old+da(i,ina(4))
         y2(i,1)=0.
         y2(i,2)=0.
         y2(i,3)=0.
      end do
      return
      end
