      SUBROUTINE ENVIR( WHAT, NB )
*
*  -- LAPACK auxiliary routine --
*     Argonne National Lab, Courant Institute, and N.A.G. Ltd.
*     April 1, 1989
*
*     .. Scalar Arguments ..
      CHARACTER         WHAT
      INTEGER           NB
*     .. 
*
*  Purpose
*  =======
*
*     ENVIR returns the block size to be used by the block algorithms.
*
*  Arguments
*  =========
*
*  WHAT   - CHARACTER
*           WHAT is a character code for the value to be returned.
*
*  NB     - INTEGER
*           The parameter NB returns an integer value from common
*           storage.
*
*     .. External Functions ..
      LOGICAL           LSAME
      EXTERNAL          LSAME
*     .. 
*     .. Intrinsic Functions ..
      INTRINSIC         MAX
*     .. 
*     .. Scalars in Common ..
      INTEGER           NBLOCK, NPROC, NSHIFT
*     .. 
*     .. Common blocks ..
      COMMON            / CENVIR / NBLOCK, NPROC, NSHIFT
*     .. 
*     .. Executable Statements ..
      IF( LSAME( WHAT, 'B' ) ) THEN
         NB = MAX( 1, NBLOCK )
      ELSE IF( LSAME( WHAT, 'P' ) ) THEN
         NB = NPROC
      ELSE IF( LSAME( WHAT, 'S' ) ) THEN
         NB = NSHIFT
      END IF
      RETURN
*
*     End of ENVIR
*
      END
