      subroutine sofie_tblbld(mt,mgs,mdet,ntb,iunit,iblk,ietl,
     &  net,novt, filene,fileno,tbl,id,ichn,ibin,mg1)
      dimension iblk(mt),ietl(mt),tbl(ntb,mdet,mt),net(*),novt(*)
      logical ibin
      character*(*) filene(mgs,mdet,*),fileno(mg1,mdet,*)
      iblocker = iblk(ichn)
      write(*,*) 'Building tbl for band ',iblocker
c      write(*,*) 'mt ' , mt,' ntb ', ntb,' mdet ', mdet,' ibin ',ibin 
c      do i = 1, 17
cc          print*, filene(1,id,i)
c      enddo
c        stop
c      print*, id, ichn, ietl(ichn)
       
      call mp_tblbld(ibin,iunit,iblocker,ietl(ichn),net(iblocker),
     &  novt(iblocker),filene(1,id,iblocker),
     &  fileno(1,id,iblocker),ntb,tbl(1,id,ichn))

c        print*, id, ichn, ietl(ichn)
c        stop
      return
      end
