	logical logi
	
	character*60  f1,ff
        character*80 head(36)


	
        if(iargc().lt.1)then
        write(*,*)
        write(*,*)
        write(*,*)'     **********   DAO_PHOT  2004.5 ***********'
        write(*,*)
        write(*,*)
	write(*,*)'     Usage:  dao_find file.fit'
	write(*,*)
	write(*,*)'     Ex:  dao_find test.fit'
	write(*,*)
	stop
	endif
	call getarg(1,f1)

        k=index(f1,'.')
        if(k.eq.0)f1=f1(1:lnblnk(f1))//'.fit'
        write(*,'(a)')f1
        inquire(file=f1,exist=logi)
        if(.not.logi)stop ' file not found !'
        open(1,file=f1,status='old',access='direct',recl=2880)
        read(1,rec=1)head
        ipos=indexpos(head,'NAXIS1  ')
	read(head(ipos)(26:30),'(i5)')ip
        ff='j_find2k '//f1
	if(ip.ge.4000.and.ip.le.4096)ff(7:7)='4'
	write(*,*)ff
	call system(ff)
        end


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


