        program sorter
c
        character*278 summ,meas(8500),mtemp
        character*45 star(8500),stemp
        dimension idate(8500)
c
        open(10,file='orb6.master.temp',status='UNKNOWN')
        open(11,file='orb6.master.temp2',status='UNKNOWN')
c
        do 100 n=1,4
        read(10,901) summ
  901   format(a278)
        write(11,903) summ
  100   continue
        write(11,902)
  902   format(277x,' ')
c
        nn=8475
        do 200 n=1,nn
        read(10,903) meas(n),star(n),idate(n)
  903   format(a278,t1,a45,t255,i4)
  200   continue
c
        do 400 n=1,nn-1
        do 300 k=n+1,nn
        if (meas(n) .eq. meas(k)) write(6,901) meas(n)
        if (star(k) .ne. star(n)) go to 300
        if (idate(k) .ge. idate(n)) go to 300
        mtemp=meas(n)
        meas(n)=meas(k)
        meas(k)=mtemp
        stemp=star(n)
        star(n)=star(k)
        star(k)=stemp
        itemp=idate(n)
        idate(n)=idate(k)
        idate(k)=itemp
  300   continue
  400   continue
c
        write(11,901) meas(1)
        do 500 n=2,nn
        if (star(n) .ne. star(n-1)) write(11,902)
        write(11,901) meas(n)
  500   continue
c
  999   stop
        end



