      CHARACTER*(*) FUNCTION FILENAME(DSN)
C
C EXTRACT FILENAME FROM FULLY QUALIFIED NAME OF STRUCTURE:
C [DIRECTORY PATH]FILENAME.EXT
C SBK 07/08/94
C
      CHARACTER DSN*(*)
C
C INITIALIZE FUNCTION VALUE
C
      FILENAME = '       '
C
C FIND END OF CHARACTER STRING
C
      I = 1
      DO WHILE ( DSN(I:I).NE.' '  ) 
       I = I + 1
      END DO
      LEN = I   
C
C FIND FIRST CHARACTER OF FILE NAME
C
      I = 1
      DO WHILE ( DSN(I:I).NE.']' .AND. I.LT.LEN ) 
       I = I + 1
      END DO
C
      IF ( I.LT.LEN ) THEN
       IBEG = I + 1
      ELSE
       IBEG = 1
      END IF
C
C FIND LAST CHARACTER OF FILE NAME
C
      I = IBEG
      DO WHILE ( DSN(I:I).NE.'.' .AND. I.LT.LEN ) 
       I = I + 1
      END DO
C
      IEND = I - 1
C
      FILENAME = DSN(IBEG:IEND)
C
      RETURN
      END
