      subroutine basinOCLsubALL(f,idim,jdim,kdim,h,filemask,
     * bOCL,numdeps)
      parameter (kdimloc=33) 
      dimension ibas(100),nstart(100)
      dimension f(idim,jdim,kdim), m1(idim,jdim)
      dimension h(kdim),hloc(kdimloc)
      character*80 filename, filemask, bOCL
      data nstart/ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     *             1, 1, 8,10,14,16,19,19,23,23,
     *            25,26,26,28,28,28,25,28,29,29,
     *            29,29,29,29,29,29,29,29,29,30,
     *            30,30,30,30,30,30,30,30,31,31,
     *            30,31, 1,14,14, 1, 6,32, 1, 1,
     *             1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     *             1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     *             1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     *             1, 1, 1, 1, 1, 1, 1, 1, 1, 1/
      data hloc/0.,10.,20.,30.,50.,75.,100.,125.,150.,200.,250.,
     *      300.,400.,500.,600.,700.,800.,900.,1000.,1100.,
     *      1200.,1300.,1400.,1500.,1750.,2000.,2500.,3000.,
     *      3500.,4000.,4500.,5000.,5500./

      call addCend(filemask,80,0)
      open(19,file=filemask,form='formatted',status='old')
      write(*,*) filemask
      do i=1,100
        read(19,*,end=500) ibas(i)
      enddo
 500  continue
      numbsns=i-1
      close(19)
      ibasinmask=-1
      call addCend(bOCL,80,0)
      call extraname('masks'//CHAR(0),bOCL,filename)
      call fileopen(filename,'rb+'//CHAR(0),ibasinmask)
      do k=1,numdeps
       call readleveli(1,1,1,1,1,idim,jdim,idim,jdim,idim,jdim,
     *                 k,k,ibasinmask,m1)
       do i=1,idim
       do j=1,jdim
          f(i,j,k)=float(m1(i,j))
       enddo
       enddo
      enddo
      call onefileclose(ibasinmask)
     
      do ii=1,numbsns
      if(ibas(ii).eq.0)then
c       kk=nstart(ii)
        xk=hloc(nstart(ii))+0.1
        do 75 k2=1,numdeps
75       if (h(k2) .le. xk ) kk=k2
        do k=kk,numdeps
        do j=1,jdim
        do i=1,idim
         ifijk=int(f(i,j,k))
         if(ifijk.eq.ii .or. ifijk.gt.numbsns) f(i,j,k)=-100.
        enddo
        enddo
        enddo
      endif
      enddo
      return
      end
