	SUBROUTINE NFIL(A,N,FM,ST,MED)
	LOGICAL*1 FNAME(50)
	LOGICAL*1 X(3)
	LOGICAL*1 Y(3)
	REAL MED
	CALL CLOSE(1)
5	WRITE(5,10)
10	FORMAT(1X,'DO YOU WANT A NEW FILE? YES/N0 '$)
	READ(5,15)(X(J),J=1,3)
15	FORMAT(3A1)
	IF(X(1).EQ.'Y') GO TO 30
	IF(X(1).EQ.'N') GO TO 120
	WRITE(5,20)	
20	FORMAT(1X,'ERROR. PLEASE TRY AGAIN.')
	GO TO 5
30	WRITE(5,40)
40	FORMAT(1X,'IS FILE FOR INPUT OR OUTPUT? IN/OUT  '$)
	READ(5,50)(Y(I),I=1,3)
50	FORMAT(3A1)
	IF(Y(1).EQ.'O') GO TO 60
	IF(Y(1).EQ.'I') GO TO 90
	WRITE(5,55)
55	FORMAT( ' YOU HAVE MADE AN ERROR. PLEASE TRY AGAIN.')
	GO TO 30
60	WRITE(5,65)
65	FORMAT(1X,'ENTER NAME OF DATA FILE  '$)
	READ(5,70)(FNAME(I),I=1,50)
70	FORMAT(50A1)
	CALL ASSIGN(2,FNAME)
	WRITE(2,80)N,FM,ST,MED
80	FORMAT(1X,' NODA= ',I5,' MEAN= ',F10.4,' STDV= ',F10.4,
     C  ' MEDN= ',F10.4)
	CALL CLOSE(2)
	GO TO 120
90	WRITE(5,95)
95	FORMAT(1X,' INPUT[320,1]DATA1.DAT OR [320,1]DATA2.DAT  '$)
	READ(5,100)(FNAME(I),I=1,50)
100	FORMAT(50A1)
	CALL ASSIGN(1,FNAME)
115	CONTINUE	
120	RETURN	
	END 
