	character*30 f1,f2
	character*80 head(72)
	logical logi
	k=iargc()
        if(k.lt.3)then
	  write(*,*)
	  write(*,*)"       usage:  putscsr batch sc sr"
	  write(*,*)
	  write(*,*)"         you can run dirccd2 to check"
	  write(*,*)
	  stop
	endif
        call getarg(1,f1)
	inquire(file=f1,exist=logi)
	if(.not.logi)stop "batch_file not found!"
	call getarg(2,f2)
	read(f2(1:),*)nsc
	call getarg(3,f2)
	read(f2(1:),*)nsr
	if(nsc.lt.0.or.nsc.gt.1748)stop "0<= SC < 2048-NC"
	if(nsr.lt.0.or.nsr.gt.1748)stop "0<= SR < 2048-NR"

	open(2,file=f1,status='old')
10      read(2,'(a)',end=20)f2
	open(1,file=f2,status='old',access='direct',recl=5760)
	read(1,rec=1)head
	ipos=indexpos(head,'NAXIS1  ')
	if(ipos.eq.73)then
	  write(*,*)f2,"          not a fits file"
	  goto 10
	endif
	read(head(ipos)(15:),*)nc
	if(nc.eq.2048)then
	  write(*,*)f2,"          it is a 2048*2048 file, sc=sr=0"
	  goto 10
	endif
	read(head(ipos+1)(15:),*)nr
	ipos=indexpos(head,'CRVAL1  ')
        if(ipos.eq.73)then
	  write(*,*)f2,"          not find key_word CRVAL1"
	  goto 10
	endif
	write(head(ipos+0)(27:30),'(i4)')nsc
	write(head(ipos+1)(27:30),'(i4)')nsr
	write(*,*)f2,nsc,nsr
	ipos=indexpos(head,'CDELT1  ')
        if(ipos.ne.73)then
          head(ipos+0)(30:30)='1'
          head(ipos+1)(30:30)='1'
        endif
	
	i=lnblnk(f2)+1
	f2(i:i)=char(0)
	call tvcoordc(f2,head)
	
	goto 10
20	close(2)
	end
	

        function indexpos(head,f1)
        character*80 head(72),f1*8
        do 10 indexpos=1,72
10      if(head(indexpos)(1:8).eq.f1)return
        end


