c	program WARY     ----  file wary.for
c	prog to set up the W array for the Jones program
c
c	written by leo mcnamara 6-jul-87
c-----	last modified 3-jul-87
c
c	the file WARRAY.DAT is modified, creating a new version of
c	the file RAY.DAT which is use by the Jones prog
c
	dimension fw(400)
	character*1 w(400,65),head(80),tail(65),blank
	data blank / ' ' /
	data fw / 400*1.e7 /
c
	open (unit=1,file='warray.dat',status='old')
	open (unit=2,file='ray.dat',status='old')
c
	do 1 i = 1,400
	do 1 j = 1,65
1	w(i,j) = blank
c
c	read in the full W array file - the last "card" for each kk
c	overwrites any previous ones
	read(1,101) head
101	format(80a1)
10	read(1,100,end=50) kk, fwkk, (tail(j),j=1,65)
c	kk = 0 is the last line of the file
	if(kk.eq.0) go to 50
	do 43 j = 1,65
43	w(kk,j) = tail(j)
	fw(kk) = fwkk
100	format(i3,f12.5,65a1)
	go to 10
50	continue
c
c	see which ones are to be modified
20	write(6,600)
600	format(//3x,'Enter the index and new W value -- i3,f10.0'/,
     a  /5x,' set W = -999. to see current value'/,
     a  /5x,' hit RETURN if finished ')
	read(5,500) iw,ww
500	format(i3,f12.0)
	if(ww.eq.-999.) write(6,102) iw,fw(iw),(w(iw,j),j=1,64)
	if(ww.eq.-999.) go to 20
	if(iw.ne.0) fw(iw) = ww
	if(iw.gt.0) go to 20
c
c	all modifications have been done - write out the new version
	write(2,101) head
	write(6,101) head
	do 400 i = 1,400
	if(fw(i).lt.99999.9) write(2,100) i,fw(i),(w(i,j),j=1,65)
	if(fw(i).lt.99999.9) write(6,102) i,fw(i),(w(i,j),j=1,64)
102	format(i4,f12.5,64a1)
400	continue
c
	izero = 0
	zero = 0.
	write(2,100) izero,zero,tail
	write(6,100) izero,zero,tail
	end