	program txt2sql
c
c	generates version of orb6orbits.txt with delimiters, for SQL database
c	At this point, must edit output file to remove blanks
c
	character*9 ra,dec
	character*10 wds
	character*54 title
	character*1 junk,x(271)
c
	open(10,file='/home/wih/Orbits/Orb6/orb6orbits.txt',
     $     status='UNKNOWN')
	open(11,file='/home/wih/Orbits/Orb6/orb6orbits.sql',
     $     status='UNKNOWN')
c
	read(10,'(a54)') title
	write(11,'(a54)') title
	do 100 n=1,6
  100	read(10,'(a1)') junk
	write(11,901)
  901	format('RA(2000).|DEC(2000)|WDS.......|DD............|ADS..|',
     $         'HD....|HIP...|V1.11|*|V2.22|*|PPPPP.PPPPPP|*|',
     $         'eee.eeeeee|AAA.AAAAA|*|ee.eeeee|III.IIII|eee.eeee|',
     $         'NNN.NNNN|*|eee.eeee|TTTTT.TTTTTT|*|eee.eeeeee|',
     $         'E.EEEEEE|e.eeeeee|OOO.OOOO|eee.eeee|EQNX|LAST|G|N|',
     $         'REF.....|PNGFILE...........')
c
  200	read(10,902,end=999) ra,dec,wds,(x(n),n=31,71),
     $     (x(n),n=73,79), (x(n),n=81,94), (x(n),n=96,117), 
     $     (x(n),n=119,155), (x(n),n=157,179), (x(n),n=181,270)
  902	format(2a9,1x,a10,1x,250a1)
	if (x(46) .eq. '.') x(46)=' '
	if (x(52) .eq. '.') x(52)=' '
	if (x(59) .eq. '.') x(59)=' '
	if ((x(68)  .eq. ' ') .and. (x(69)  .eq. '.'))  x(69)=' '
	if ((x(76)  .eq. ' ') .and. (x(77)  .eq. '.'))  x(77)=' '
	if ((x(87)  .eq. ' ') .and. (x(88)  .eq. '.'))  x(88)=' '
	if ((x(100) .eq. ' ') .and. (x(101) .eq. '.')) x(101)=' '
	if ((x(111) .eq. ' ') .and. (x(112) .eq. '.')) x(112)=' '
	if ((x(122) .eq. ' ') .and. (x(123) .eq. '.')) x(123)=' '
	if ((x(132) .eq. ' ') .and. (x(133) .eq. '.')) x(133)=' '
	if ((x(141) .eq. ' ') .and. (x(142) .eq. '.')) x(142)=' '
	if ((x(150) .eq. ' ') .and. (x(151) .eq. '.')) x(151)=' '
	if ((x(161) .eq. ' ') .and. (x(162) .eq. '.')) x(162)=' '
	if ((x(172) .eq. ' ') .and. (x(173) .eq. '.')) x(173)=' '
	if ((x(185) .eq. ' ') .and. (x(186) .eq. '.')) x(186)=' '
	if ((x(194) .eq. ' ') .and. (x(195) .eq. '.')) x(195)=' '
	if ((x(203) .eq. ' ') .and. (x(204) .eq. '.')) x(204)=' '
	if ((x(214) .eq. ' ') .and. (x(215) .eq. '.')) x(215)=' '
	if ((x(223) .eq. ' ') .and. (x(224) .eq. '.')) x(224)=' '
	x(45)='|'
	x(51)='|'
	x(58)='|'
	x(65)='|'
	x(72)='|'
	x(74)='|'
	x(80)='|'
	x(82)='|'
	x(95)='|'
	x(97)='|'
	x(108)='|'
	x(118)='|'
	x(120)='|'
	x(129)='|'
	x(138)='|'
	x(147)='|'
	x(156)='|'
	x(158)='|'
	x(167)='|'
	x(180)='|'
	x(182)='|'
	x(193)='|'
	x(202)='|'
	x(211)='|'
	x(220)='|'
	x(229)='|'
	x(234)='|'
	x(239)='|'
	x(241)='|'
	x(243)='|'
	x(252)='|'
c
c	remove blanks
c
	nlast=270
	do 400 n=271,46,-1
	if (x(n) .ne. ' ') go to 400
	do 300 m=n,270
  300	x(m)=x(m+1)
	nlast=nlast-1
  400	continue
c
	do 600 n=44,33,-1
	if (x(n) .ne. ' ') go to 700
	do 500 m=n,270
  500	x(m)=x(m+1)
	nlast=nlast-1
  600	continue
c
  700	write(11,903) ra,dec,wds,(x(n),n=31,nlast)
  903	format(a9,'|',a9,'|',a10,'|',241a1)
	go to 200
c
  999	stop
	end


