cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c	UBBS utilities - Convert_files.for
c	This program converts the FILES.DAT files into FILES.IDX files for
c	UBBS Rev. 4.0
c	Dale Miller - UALR
c	27-Jun-1986
c
c	Rev. 4.0  27-Jun-1986
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
	implicit none
	include 'bbs_inc.for'
	character cdate*9,cdate2*11
	integer str$upcase,istat,sys$bintim,txtlen

	record/file_description/ fd

	open(unit=1,file='files.dat',readonly,shared,status='old')

	open(unit=2,file='files.idx',status='new',organization='indexed',
	1   access='keyed',recl=128,form='unformatted',
	2   recordtype='fixed',key=(1:18:character))

 1001	format(a18,i3,1x,a1,6x,a9,1x,q,a)
 1002	format(67x,a11)

	fd.file_name='$Header'
	fd.upload_name='DALE MILLER'
	fd.keywords=' '
	fd.times_down=0
	fd.upload_text=' '
	read(1,1002)cdate2
	istat = str$upcase(cdate2,cdate2)
	istat = sys$bintim(cdate2//' 00:00:00.00',fd.upload_date)
	write(2)fd
	read(1,1001)fd.file_name

	fd.upload_name=' '
	fd.keywords=' '
	fd.times_down=0

 0010	read(1,1001,end=99)fd.file_name,fd.file_size,
	1   fd.file_type,cdate,txtlen,fd.upload_text
	fd.upload_text(txtlen+1:txtlen+1)=char(cr)
	istat = str$upcase(cdate,cdate)
	istat = sys$bintim(cdate(1:7)//'19'//
	1   cdate(8:9)//' 00:00:00.00',fd.upload_date)
	print*,'file='//fd.file_name//' type='//fd.file_type//' date='//
	1   cdate
	print*,'file_size=',fd.file_size
	write(2)fd
	go to 10
 0099	print*,'finished'
	end
