
!if erase=$job2 and and .. notin $job2 and $block!=main
  !sh rm -f $wims_home/$Docdir/$doc/src/$block; rm -f $wims_home/$Docdir/$doc/src/$block.hd ; rm -f $wims_home/$Docdir/$doc/$block.def
  !read index.proc
!endif
fcnt=!recordcnt $docdir/$doc/.index
fcnt=$[min($fcnt,$blocklim)]

!for i=1 to $fcnt
  l=!record $i of $docdir/$doc/.index
  !distribute lines $l into s_,t_
  t_=!detag $t_
  slist=!append line $s_ to $slist
  tlist=!append line $ $t_ to $tlist
!next i

slist=!sort nocase lines $slist
tlist=!line $wims_sort_order of $tlist
!read quota.proc
