        program wdscheck
c
c       check precise coordinates and magnitudes against wds.summ, for possible updates
c
        character*100 star(12000),star1
        character*18 rad(12000),rad1
        character*12 dd(12000),dd1
        character*10 wds(12000),wds1
        character*5 v1(12000),v2(12000),v11,v21
        integer iflag(12000)
        character*1 junk,nflag(12000),nflag1
c
        open(10,file='orb6.master',status='UNKNOWN')
        open(11,file='/home/wih/WDS/wds.summ',status='UNKNOWN')
        open(12,file='wdscheck.check',status='UNKNOWN')
        open(13,file='wdscheck.nomatch',status='UNKNOWN')
c
        do 100 n=1,4
        read(10,901) junk
  901   format(a1)
  100   continue
c
c       read all orbits
c
        norb=0
  200   read(10,902,end=300) star1,junk,rad1,wds1,dd1,v11,v21,nflag1
  902   format(a100,t1,a1,t1,a18,1x,a10,1x,a12,t67,a5,t74,a5,t248,a1)
        if (junk .eq. ' ') go to 200
        norb=norb+1
        star(norb)=star1
        rad(norb)=rad1
        wds(norb)=wds1
        dd(norb)=dd1
        v1(norb)=v11
        v2(norb)=v21
        nflag(norb)=nflag1
        iflag(norb)=0
        go to 200
c
  300   read(11,903,end=500) wds1,dd1,v11,v21,rad1,nflag1
  903   format(a10,a12,t59,a5,1x,a5,t113,a18,t108,a1)
        do 400 n=1,norb
        if (wds1 .ne. wds(n)) go to 400
        if (dd1 .ne. dd(n)) go to 400
        iflag(n)=1
        if (rad1 .ne. rad(n)) write(12,904) star(n),rad1
  904   format(a100,2x,a18)
        if ((v11 .ne. v1(n)) .or. (v21 .ne. v2(n))) 
     $     write(12,905) star(n),v11,v21
  905   format(a100,2x,a5,1x,a5)
        if ((nflag1 .eq. 'N') .and. (nflag(n) .eq. ' '))
     $     write(12,906) star(n),nflag(n),nflag1
  906   format(a100,2x,a1,' --> ',a1)
        if ((nflag1 .eq. ' ') .and. (nflag(n) .eq. 'n'))
     $     write(12,906) star(n),nflag(n),nflag1
  400   continue
        go to 300
c
  500   do 600 n=1,norb
        if (iflag(n) .eq. 0) write(13,907) star(n)
  907   format(a100)
  600   continue
c
  999   stop
        end


        
