      SUBROUTINE WFERR (SNAME, MESSAG, LEVEL)
C***BEGIN PROLOGUE  WFERR
C***PURPOSE  Processes an error message for the vectorized special
C            function package
C***LIBRARY   VFNLIB
C***TYPE      CHARACTER
C***AUTHOR  SAUNDERS, B. V., (NIST)
C             COMPUTING AND APPLIED MATHEMATICS LABORATORY
C             NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY
C             GAITHERSBURG, MD 20899
C           BOISVERT, R. F., (NIST)
C             COMPUTING AND APPLIED MATHEMATICS LABORATORY
C             NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY
C             GAITHERSBURG, MD 20899
C***DESCRIPTION
C
C   WFERR processes an error message for the vectorized special
C   function package.
C
C   P A R A M E T E R S
C
C   SNAME  (Input) Character*(*)
C          The name of the routine issuing the message.
C
C   MESSAG (Input) Character*(*)
C          The error message.  Must be less than 80 characters.
C
C   LEVEL  (Input) Integer
C          The message level.  1 for recoverable, 2 for fatal.
C
C   This routine issues a STOP for fatal errors.
C
C
C***ROUTINES CALLED  (NONE)
C***REVISION HISTORY  (YYMMDD)
C   910226  DATE WRITTEN
C***END PROLOGUE  WFERR
C
C     ... PARAMETERS
C
      CHARACTER*(*)  MESSAG, SNAME
      INTEGER        LEVEL
C
C     ... LOCAL VARIABLES
C
      INTEGER IUNIT, I1MACH, MLEN
C
C***FIRST EXECUTABLE STATEMENT  WFERR
C
      IUNIT = I1MACH(4)
      MLEN = MIN(LEN(MESSAG),80)
C
      WRITE(IUNIT,*)
      IF (LEVEL .EQ. 2) THEN
         WRITE(IUNIT,*) 'FATAL ERROR IN ',SNAME,' ...'
         WRITE(IUNIT,*) MESSAG(1:MLEN)
         STOP
      ELSE
         WRITE(IUNIT,*) 'RECOVERABLE ERROR IN ',SNAME,' ...'
         WRITE(IUNIT,*) MESSAG(1:MLEN)
         RETURN
      ENDIF
C
      END