	program translate
c
c  Comvert Lytle save files so that they can be read by PROCESS
c  from SSRL
c  RLG, 10/14/93
c
	real*4 x(2048),y(2048)
	character*80 buf
	character*64 flname, outfile
	character*1 dum(1:64),q
	integer i,ii(2048),lim,file_status,index,flen
	equivalence(dum(1),flname)
	character*5 flag
c
c  Get file
800	print 700
700	format('$ Enter Input File Name: ')
	read(*,805) flname
805 	format(a)
	if(dum(1).eq.'q'.OR.dum(1).eq.'Q') goto 2000
c
	do 10 i=1,64
	if(dum(i).eq.' ') dum(i)=char(0)
10	continue
c
	if(index(flname,'.A').ne.0.or.index(flname,'.a').ne.0) then
		flag='SHIFT'
	else
		flag='XNMIN'
	endif
c
	print *, 'flag= ',flag
c
	flen=index(flname,char(0))-1
      open(10, file=flname(1:flen), status='old',
     - 	       iostat=file_status, access='sequential',err=1010)
c 
5	read(10,805) buf
	print *, buf
	if(index(buf,flag).ne.0) goto 87
	goto 5
c--Start number loop, 4 sets per row
c
87	low=1
	lup=4
89	read(10,200,iostat=file_status,err=1000,end=300) 
     - 		(ii(i),x(i),y(i),i=low,lup)
c  Diagnostics
c	do 25 i=low,lup
c	print *, ii(i),x(i),y(i)
c25	continue
c
200	format(4(i5,2(1pe13.5)))
	low=low+4
	lup=lup+4
	goto 89
300	lim=i
	if(flag.eq.'SHIFT') lim=i-1
	close(10)
	print 35, lim
35	format(1x,i5,' Points',/,'$ Enter Output File: ')
	read(*,805) outfile
	open(12, file=outfile, status='new', err=1000)
	do 30 i=1,lim
	if(x(i).eq.0.0.and.flag.eq.'XNMIN') goto 210	!Never will have k=0.0
	write(12,205) x(i),y(i)
30	continue
205	format(2(1pe13.5))
	continue
210	close(12)
c
2000	stop ' Conversion Complete'

1010	print 1015, file_status
1015	format(' Open Error! Status=',i6)
	goto 800
1000	print 1025, file_status
1025	format(' Read Error! Status= ',i4)
	print *,buf
	goto 800
c
	end

