        program temp
c
        character*243 data(1620),data1
	character*3 grade(1620),grade1
	character*14 ref(1620),ref1
	character*18 png(1620),png1
	integer iflag(1620)
c
        open(10,file='orbits.6', status='UNKNOWN')
        open(11,file='orb6.master', status='UNKNOWN')
        open(12,file='orb6.master.new', status='UNKNOWN')
        open(13,file='orb6.check', status='UNKNOWN')
c
	do 100 n=1,1618
   	read(10,901) data(n),grade(n),ref(n),png(n)
  901	format(a243,a3,a14,a18)
	iflag(n)=0
  100	continue
c
	do 200 n=1,4
	read(11,901) data1,grade1,ref1,png1
	write(12,901) data1,grade1,ref1,png1
  200	continue
c
  300	read(11,901,end=600) data1,grade1,ref1,png1
	if (ref1 .eq. '              ') go to 500
	if (grade1 .eq. '6.6') go to 350
	if (grade1 .eq. '8.0') go to 350
	if (grade1 .eq. '9.0') go to 350
	png1='                  '
  350	do 400 n=1,1618
	if (data1 .ne. data(n)) go to 400
	png1=png(n)
	grade1=grade(n)
	iflag(n)=iflag(n)+1
	go to 500
  400	continue
c
  500	write(12,901) data1,grade1,ref1,png1
	go to 300
c
  600	do 700 n=1,1618
	if (iflag(n) .eq. 1) go to 700
	write(13,902) data(n),grade(n),ref(n),png(n),iflag(n)
  902	format(a243,a3,a14,a18,i3)
  700	continue
c
  999   stop
        end
