C!----------------------------------------------------------
	SUBROUTINE GET_FILES(file_list,num_files,max_file,max_lbl)
C
C   Subroutine to enter get file numbers from parameter list 
C-----------------------------------------------------------
	include 'shared$common'
	INTEGER LEN,file_list(10),num_files
	INTEGER STATUS,CLI$GET_VALUE
	CHARACTER*20 PARM
	CHARACTER*6 labels(8)/'file_1','file_2','file_3','file_4','file_5',
	1	'file_6','file_7','file_8'/

	num_files = 0
	max_files = min(max_file,10)
	max_label = min(max_lbl,8)
	
	do i=1,10
	  file_list(i) = 0
	enddo

	do i=1,max_label 
1	  STATUS = CLI$GET_VALUE(labels(i),parm,len)
C is there a valid parameter here?
	  if (status .and. len .gt. 0) then 
C Convert character string to a number
	    read(unit=parm(1:len),fmt='(I)',err=1) num
C is it a valid number?
	    if (num .gt. 0 .and. num .le. MFILE) then 
	      num_files = num_files + 1
	      file_list(num_files) = num
	    else
		WRITE(LO,44) num,MFILE
44		FORMAT (' FILE NUMBER 'I2' IS OUT OF THE RANGE 1 - 'I2,
	1 	2X,'IGNORING THIS FILE ENTRY.')
	    endif
	    if (num_files .ge. max_files) return
	    goto 1
	  endif
	enddo
	return
	end
