C---------------------------------------------------------------------------
	CHARACTER*80 FUNCTION fil_trunc(file,num)
C---------------------------------------------------------------------------
C  Returns a new file name where the extension has been changed and
C  the version number has been dropped.
C  NOTE: ext is not required to start with a period
C---------------------------------------------------------------------------
	CHARACTER*(*) file
	integer num

	character*40 node,device,dir,name*60,type*20,ver*5
	integer*2 len_node,len_device,len_dir,len_name,len_type,len_ver
	integer*2 ln

	ln = lench(file)
C is the name ok as is?
	if (ln .le. num) then 
	  fil_trunc = file
	  return
	endif

C parse the file name and see if dropping the version # does it
	call fparse(file,node,len_node,device,len_device,
	1	dir,len_dir,name,len_name,type,len_type,ver,len_ver)
	ln = len_node + len_device + len_dir + len_name + len_type
	fil_trunc = node(:len_node)//device(:len_device)//dir(:len_dir)
	1	//name(:len_name)//type(:len_type)
	if (len .le. num) return
	fil_trunc = '...'//fil_trunc(ln+4-num:ln)
	RETURN
	END
