      subroutine ecr(b,l,n,ifil)
      parameter (ngru3=2048)
      IMPLICIT REAL*8(A-H,O-Z)
      dimension b(n)
c      write(6,*)'ecr l,n,ifil',l,n,ifil
      nn=n/ngru3
      ll=(l-1)*(n/ngru3+1)
      do k=1,n,ngru3
         ll=ll+1
c          write(ifil,rec=l) b
         long=min0(ngru3,n-k+1)
         call ecric(b(k),ll,long,ifil)
      enddo
      return
      end
       subroutine ecric(b,ll,long,ifil)
      IMPLICIT REAL*8(A-H,O-Z)
      dimension b(long)
c       print*,'ecric ll',ll,ifil,long
      write(ifil,rec=ll) b
      return
      end
