        program add_errors
c
c       substitutes new lines (including formal errors) for old in orb6 master file.
c       Lines must match both star name (first 46 columns) and png file (last 18
c       columns) to be considered a match. New lines which don't match are sent to
c       another file to check
c
        character*277 data(500),data1
        character*46 star(500),star1
        character*18 png(500),png1
        integer iflag(500)
c
        open(10,file='orb6_errors3.txt',status='UNKNOWN')
        open(11,file='orb6.master10',status='UNKNOWN')
        open(12,file='orb6.master11',status='UNKNOWN')
        open(13,file='add_errors.nomatch',status='UNKNOWN')
c
        nerr=110
        do 100 n=1,nerr
        read(10,901) data(n),star(n),png(n)
  901   format(a277,t1,a46,t260,a18)
        iflag(n)=0
  100   continue
c
  200   read(11,901,end=800) data1,star1,png1
        if (png1 .eq. '                  ') go to 700
        do 300 n=1,nerr
        if (iflag(n) .eq. 1) go to 300
        if (star1 .ne. star(n)) go to 300
        if (png1 .ne. png(n)) go to 300
        iflag(n)=1
        data1=data(n)
        go to 700
  300   continue
c
  700   write(12,902) data1
  902   format(a277)
        go to 200
c
  800   do 900 n=1,nerr
        if (iflag(n) .eq. 0) write(13,901) data(n)
  900   continue
c
  999   stop
        end

