	character*80 f0,f1,f2,head(72)
	real a(2048*2048)

        k=iargc()
	if(k.lt.3)then
	  write(*,*)
	  write(*,*)'         ******** divfit 2048*2048 Pic. ***2000.7'
	  write(*,*)
          write(*,*)'  divfit input output 4'
	  stop
	endif

	call getarg(1,f0)
	call gethead(f0,head)
	call readata(a,f0)	
	
	call getarg(2,f1)
	call getarg(3,f2)
	read(f2(1:),*)k
	do 10 i=1,2048*2048
10	a(i)=a(i)/k

	call swap4(a,2048*2048*4)
        k=2048*2048*4+5760
	open(50,file=f1,status='unknown',access='direct',recl=k)
	write(50,rec=1)head,a
	close(50)
	end

        subroutine readata(a,f1)
        integer c(720),a(1)
        character*80 f1,ch*2880
        equivalence (c,ch)
        nn=720         
        open(1,file=f1,status='old',access='direct',recl=nn*4)
        read(1,rec=1)ch
        n1=2048   
        n2=2048
        n=1   
55      k=index(ch,'END          ')
        if(k.eq.0)then
          n=n+1    
          read(1,rec=n)ch
          goto 55  
        endif   
        i=0
        k1=n+1
        k2=n+(n1*n2-1)/nn
        do 60 k=k1,k2
        if(mod(k,200).eq.0)call dispdot()
        read(1,rec=k)ch
        do 60 j=1,nn
        i=i+1
60      a(i)=c(j)
        close (1)
	call swap4(a,n1*n2*4)
        end
 
	subroutine gethead(f1,head)
	character*80 f1,head(72)
	open(52,file=f1,status='old',access='direct',recl=5760)
	read(52,rec=1)head
	close (52)
	end
