	parameter (n=5536)
	character*133 d0,d1
	real a(n),d(n),c(n),z(n)
	real x(n),y(n)
	
	open(1,file='Ta24i_12.mag1',status='old')
	do 10 i=1,n
	read(1,'(a)')d0
	read(1,'(a)')d1
        call tohd(d1(2:24),a(i),d(i))
	read(d1(39:),*)j
	c(i)=j*0.001
10	continue
	close(1)
	write(*,*)'*.mag1 read_in'
	open(1,file='TA24c.cat',status='old')
	k=0
	do 19 i=1,n
19	x(i)=0.
	read(1,'(a)')d0
20	read(1,'(a)',end=30)d1
        call tohd(d1(2:24),aa,dd)
	s=2.
	do 21 i=1,n
        r=(aa-a(i))**2*60.+(dd-d(i))**2
	if(r.lt.s)then
	  s=r
          j=i
	endif
21	continue
	s=s*3600*3600.
	ss=1.
	if(c(j).lt.15) ss=1.-(c(j)-15)*0.1
	if(s.lt.ss)then
	  k=k+1	
	  x(j)=j
	  read(d1(43:),*)y(j)
	  z(j)=s
	endif

	goto 20
30	write(*,*)k
	do 40 i=1,n
40	if(x(i).ne.0.)write(*,'(i5,3f9.3)')i,c(i),y(i),z(i)
	write(*,*)k
	end

        subroutine tohd(cc,alpha,delta)
        character*(*) cc
        character*20 dd
        k1=index(cc,' ')
        k2=index(cc,',')
        k=min(k1,k2)
        if(k1.eq.0)k=k2
        if(k2.eq.0)k=k1
        dd=cc(1:k)
        do 10 i=1,9
10      if(dd(i:i).eq.':')dd(i:i)=','
        read(dd(1:),*,end=15)x,y,z
15      alpha=x+y/60.+z/3600.
        do 16 i=k+1,k+6
        if(cc(i:i).ne.' ')goto 17
16      continue
17      dd=cc(i:)
        k1=index(dd,' ')
        k2=index(dd,',')
        k=min(k1,k2)
        if(k1.eq.0)k=k2
        if(k2.eq.0)k=k1
        do 20 i=1,k
20      if(dd(i:i).eq.':')dd(i:i)=','
        read(dd(1:K),*,end=30)x,y,z
30      if(x.lt.0.)x=-x
        delta=x+y/60.+z/3600.
        if(index(cc,'-').ne.0)delta=-delta
        end


