	parameter (n=10751)
	character*133 d0,d1
	real a(n),d(n)
	real ca(n),cb(n),cc(n)
	real x(2000),y(2000)
	z=7.5   ! cos(60)*15
	ia=0
	ib=0
	ic=0
	open(1,file='Ta03j_16.mag2',status='old')
	do 10 i=1,10751
	read(1,'(a)')d0
	read(1,'(a)')d1
        call tohd(d1(9:32),a(i),d(i))
	read(d1(38:),*)ca(i),cb(i),cc(i)
	if(ca(i).gt.0.)ia=ia+1
	if(cb(i).gt.0.)ib=ib+1
	if(cc(i).gt.0.)ic=ic+1
10	continue
	close(1)
	write(*,*)ia,ib,ic
	write(*,*)'*.mag2 read_in'
	open(1,file='p3573798TA03a.cat',status='old')  !!!
	open(2,file='TA03a.cat',status='unknown')      !!!
	k=0
	read(1,'(a)')d0
20	read(1,'(a)',end=30)d1
        call tohd(d1(2:24),aa,dd)
	s=1.
	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.
	if(s.lt.9)then
	  k=k+1	
	  x(k)=ca(j)                                !!!
	  read(d1(43:),*)y(k)
	  write(d1(58:),'(i5)')j
	  write(2,'(a)')d1(1:62)
	endif

	goto 20
30	write(*,*)k
	close(2)
	call pgbegin(0,"/xw",1,1)
	call pgenv(9.,22.,9.,22.,0,0)
	call pgpoint(k,x,y,-1)
	call pgend
	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


