	SUBROUTINE GFNAME(NAME,UNIT,EXT)
	LOGICAL NAME(11),EXT
	INTEGER UNIT
	LOGICAL COLON,FNAME(14),DOT
	COLON = ':'
	DOT   = '.'
C
C	READ A USER DATA FILE NAME
C
C	NAME:	RETURN PARAMETER OF FILE NAME
C	UNIT:	RETURN PARAMETER OF UNIT
C			0	DEFAULT DRIVE
C			1	DRIVE A ETC
C	EXT:	INPUT PARAMETER
C		TRUE : EXTENSION REQUIRED
C		FALSE: EXTENSION NOT PERMITTED
C
C
C
	UNIT = 0
  10    IF(.NOT.EXT)WRITE(1,101)
	IF(EXT) WRITE(1,100)
	READ(1,104)FNAME
	IF(FNAME(2).NE.COLON) GOTO 14
	UNIT = FNAME(1) - 'A' + 1
	DO 15 I= 1 , 12
		FNAME(I)=FNAME(I+2)
  15	CONTINUE
C
C	FIND AND REMOVE '.' IN FILE NAME
C
   14	DO 16 I=1,11
	IF (FNAME(I).EQ.DOT) GO TO 17
   16	CONTINUE
C	NO PERIOD! ILLEGAL FILE NAME?
	IF(.NOT. EXT) GO TO 20
	WRITE(1,105)
	GOTO 10

   17	M1 = I + 3
	DO 33 J = I,M1
   33	FNAME(J) = FNAME(J+1)
	N=11
	DO 18 J=1,3
	M1=I+3 - J
	FNAME(N)=FNAME(M1)
   18	N=N-1
	IF(I.GE.9)GOTO 20
	DO 19 J=I ,8
   19	FNAME(J)=' '
C	
C	FILE NAME IS O.K
C	TRANSFER TO PARAMETER
C
   20	DO 25 I=1,11
   25	NAME(I) = FNAME(I)
	RETURN
  100	FORMAT(' ENTER FILENAME (WITH EXTENSION) ---> ')
  101	FORMAT(' ENTER FILENAME (WITHOUT EXTENSION -> ')
  104	FORMAT(14A1)
  105	FORMAT(' ILLEGAL FILENAME! PLEASE REENTER')
	END

MAT(' ENTER FILEN