      LOGICAL FUNCTION ANSYES()
      CHARACTER ANSWER*1, C*1, UPCASE,ELT
      READ(*,'(A)') ANSWER
      C=UPCASE(ANSWER)
      IF (C.EQ.'Y') THEN
         ANSYES=.TRUE.
      ELSE
         ANSYES=.FALSE.
      ENDIF
      END

      CHARACTER*1 FUNCTION ELT(STRING,I)
      CHARACTER WORKA(127)*1,WORKS*127
      WORKS=STRING
      ELT=WORKA(I)
      END

      CHARACTER*1 FUNCTION UPCASE(C)
      CHARACTER C
      IF (('a'.LE.C).AND.(C.LE.'z')) THEN
         UPCASE= CHAR(ICHAR(C)-32)
      ELSE
         UPCASE=C
      ENDIF
      END

	SUBROUTINE DEFOUT(LUN)
	CHARACTER*14 FNAME
	WRITE(*,*)'File name: '
	READ(*,'(A)')FNAME
	OPEN(LUN,STATUS='NEW',FILE=FNAME)
	RETURN
	END
	
	SUBROUTINE DEFIN(LUN)
	CHARACTER*14 FNAME
	WRITE(*,*) 'File name: '
	READ(*,'(A)') FNAME
	OPEN(LUN,STATUS='OLD',FILE=FNAME)
	RETURN
	END
