	parameter (m=13500)
	character*60 f1,f2
	real x1(m),y1(m),xmag1(m)
	real x2(m),y2(m),xmag2(m)
	if(iargc().lt.2)then
	  write(*,*)'  Usage: twocheck file1(a03j.cat) file2'
	  write(*,*)
	  stop
	endif
	call getarg(1,f1)
        open(1,file=f1,status='old')
	read(1,'(a)',end=20)f1
	i=0
	j=0
10	i=i+1
	read(1,'(a)',end=20)f1
	if(f1(1:1).ne.' ')then
	  j=j+1
	  i=i-1
	else
  	  call ihd(f1,x1(i),y1(i))
	  read(f1(42:),*)xmag1(i)
	endif
	goto 10
20	n1=i-1
	close(1)
	write(*,*)'file1 data readin:',n1,'  marked:',j,' all:',n1+j

	call getarg(2,f2)
        open(1,file=f2,status='old')
	read(1,'(a)',end=120)f2
	i=0
	j=0
110	i=i+1
	read(1,'(a)',end=120)f2
	if(f2(1:1).ne.' ')then
	  j=j+1
	  i=i-1
	else
	  call ihd(f2,x2(i),y2(i))
	  read(f2(42:),*)xmag2(i)
	endif
	goto 110
120	n2=i-1
	close(1)
	write(*,*)'file2 data readin:',n2,'  marked:',j,' all:',n2+j

	ip=0
	do 30 i=1,n1
	z1=x1(i)
	z2=y1(i)
	do 30 j=1,n2	
	z=(x2(j)-z1)**2+(y2(j)-z2)**2	
c30	if(z.le.4.)write(*,'(f5.2,2(i5,f6.2))')z,i,xmag1(i),j,xmag2(j)
30	if(z.le.4.)ip=ip+1
	write(*,*)ip
c 2*2 arcsec
	end	

	subroutine ihd(a,x,y)
	character*60 a
	read(a(1:),'(2(1x,i2,1x,i2,1x,f5.2))')i1,j1,z1,i2,j2,z2
	x=(i1*3600+j1*60+z1)*15
	y= i2*3600+j2*60+z2
	end
