	program wdsextract
c
c	modification of Gary's program to pluck out data
c	from WDS catalogue for orbital analysis
c
c	input file is list of wds summary lines
c
	implicit none

	character*90 summ
	character*80 info
	character*18 filename
	character*10 radc
	character*22 instar,wdsstar
	character*7 wdsid
	character*5 wdscomp
	character*2 hr,orb
	character*1 fhr
	real*8 min,date,indate

	open (150,file='diana.1')
	open (300,file='diana.2')
c
   50	read(150,'(a2,f3.1,t1,a22,t1,a90)',end=999) 
     $     hr,min,instar,summ
	indate=9999.
	orb='NO'
c
10	if (min .lt. 30.0) fhr='0'
	if (min .ge. 30.0) fhr='5'
	filename='wds'//hr//fhr//'.data'
	open (200,file=filename)
20	read (200,'(a22,t1,a80)',end=10) wdsstar,info
25	continue
	if (wdsstar .eq. instar) then
	  write(300,'(a80)') info
	  write(300,'(a2)') orb
30	  read (200,'(bz,a10,a7,a5,f8.4,t1,a80)',end=10) 
     $     radc,wdsid,wdscomp,date,info
	    if (wdsid .ne. ' ') then
	     write(300,'(80x)')
	    close(200)
		go to 50
	    endif
	    if (date .lt. indate) write(300,'(a80)') info
	    go to 30
	  endif
	  go to 20

111	stop 'input identification not found'
999	stop 'program finished'
	end

