C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C                .      .    .                                       .
C SUBPROGRAM:    MSETSNOWPVDR SET SNOW PROVIDER TO ENABLED/DISABLED
C   PRGMMR: L. BENJAMIN      ORG: FSL        DATE: 05-11-18
C
C ABSTRACT: ENABLE OR DISABLE ONE MADIS DATA PROVIDER.
C
C PROGRAM HISTORY LOG:
C   05-11-18  L. BENJAMIN ORIGINAL VERSION
C
C USAGE:    CALL MSETSNOWPVDR (PROVDR,FLAG,STATUS)
C
C   INPUT ARGUMENT LIST:
C     PROVDR   - C       PROVIDER NAME (.LE. 10 CHARACTERS)
C     FLAG     - L       .TRUE. - ENABLE, .FALSE. - DISABLE
C
C   OUTPUT ARGUMENT LIST:
C     STATUS   - I       0 - SUCCESS, OR ERROR CODE
C
C SUBPROGRAMS CALLED:
C     UNIQUE:    MERROR
C
C REMARKS:
C   - IN ADDITION TO THE PROVIDER NAMES THE CALLER CAN USE 'ALL-SNOW' 
C   - THE MADISCOM PROVIDER ARRAYS (NPVD, PVDNAME, ETC.) HAVE SFC
C     PROVIDERS IN ROW 1, SNOW PROVIDERS IN ROW 2.
C
C ATTRIBUTES:
C   LANGUAGE: FORTRAN-77 + EXTENSIONS
C   MACHINE:  UNIX
C$$$

      SUBROUTINE MSETSNOWPVDR(PROVDR,FLAG,STATUS)

C     ------------------------------------------------------------------
C     INCLUDES AND COMMONS
C     ------------------------------------------------------------------
      INCLUDE 'IMPLICIT'
      INCLUDE 'MADISCON'
      INCLUDE 'MADISCOM'

C     ------------------------------------------------------------------
C     ARGUMENTS
C     ------------------------------------------------------------------
      CHARACTER*(*) PROVDR
      INTEGER STATUS
      LOGICAL FLAG

C     ------------------------------------------------------------------
C     LOCAL
C     ------------------------------------------------------------------
      CHARACTER*10 PROVDR_L
      INTEGER N,I

      N = LEN(PROVDR)
      PROVDR_L = PROVDR(1:N)
      DO 1 I = 10, N+1, -1
         PROVDR_L(I:I) = ' '
 1    CONTINUE

      IF(SNOW_INIT.NE.INIT_P)THEN
         STATUS = SELSUB_NOTINIT_P
         CALL MERROR('MSETSNOWPVDR: SELECTED SUBSYSTEM NOT '//
     1               'INITIALIZED - SNOW')
         GO TO 900
      ENDIF

      STATUS = SUCCESS_P

      IF(PROVDR_L.EQ.'ALL-SNOW ')THEN

C     ------------------------------------------------------------------
C     USE FLAG FOR ALL PROVIDERS ALREADY IDENTIFIED, AND USE IT FOR ANY 
C     NEW PROVIDERS THAT HAVE ALREADY BEEN SPECIFIED VIA AN EARLIER CALL
C     TO THIS ROUTINE, BUT THAT HAVEN'T YET SHOWN UP AND GOTTEN
C     ENABLED/DISABLED.
C     ------------------------------------------------------------------
         DO 2 I = 1, MAX_SNOWDSET_P
            SNOWDSET_ENBL(I) = FLAG
 2       CONTINUE

         DO 3 I = 1, NPVD(8)
            PROVDR_ENBL(I,8) = FLAG
 3       CONTINUE

         ALL_ENBL(8) = FLAG

         DO I = 1, NNEWPVD(8)
            NEW_ENBL(I,8) = FLAG
         ENDDO

      ELSE

C     ------------------------------------------------------------------
C     WE CURRENTLY ONLY HAVE ONE SNOW DATASET.  IF & WHEN WE HAVE MORE,
C     WE'LL NEED TO CHECK THE PROVDR_L AGAINST NON-LDAD-SNOW ONES,
C     AND ACT ACCORDINGLY (AS IN THE SFC VERSION OF THIS ROUTINE).
C     ------------------------------------------------------------------
         SNOWDSET_ENBL(LSNOW_DS_P) = FLAG

         DO 5 I = 1, NPVD(8)

            IF(PVDNAME(I,8).EQ.PROVDR_L)THEN

               PROVDR_ENBL(I,8) = FLAG

               GO TO 100

            ENDIF

 5       CONTINUE

C     ------------------------------------------------------------------
C     IF WE HAVEN'T HIT MAX_SUBSRC_P IN THE NEW PROVIDER LIST, ADD
C     AN ENTRY FOR THIS AS-YET-UNKNOWN PROVIDER.
C     ------------------------------------------------------------------
         IF(NNEWPVD(8).NE.MAX_SUBSRC_P)THEN
               
            NNEWPVD(8) = NNEWPVD(8) + 1
            NEWPVDNAME(NNEWPVD(8),8) = PROVDR_L
            NEW_ENBL(NNEWPVD(8),8) = FLAG

         ENDIF

      ENDIF

 100  IF(STATUS.EQ.SUCCESS_P)THEN

C     ------------------------------------------------------------------
C     CLEAR THE LAST TIME READ FIELD SO NEW STATIONS WILL HAVE TO BE
C     LOADED.  
C     ------------------------------------------------------------------
         LAST_SNOW_ATIME = '         '

      ENDIF

 900  RETURN
      END
C**---------------------------------------------------------------------
C**REQUIRED STANDARD FSL DISCLAIMER (NOVEMBER 2000)
C**---------------------------------------------------------------------
C**  OPEN SOURCE LICENSE/DISCLAIMER,  FORECAST SYSTEMS LABORATORY
C**  NOAA/OAR/FSL, 325 BROADWAY BOULDER, CO 80305
C**
C**  THIS SOFTWARE IS DISTRIBUTED UNDER THE OPEN SOURCE DEFINITION, 
C**  WHICH MAY BE FOUND AT http://www.opensource.org/osd.html.
C**
C**  IN PARTICULAR, REDISTRIBUTION AND USE IN SOURCE AND BINARY FORMS,
C**  WITH OR WITHOUT MODIFICATION, ARE PERMITTED PROVIDED THAT THE 
C**  FOLLOWING CONDITIONS ARE MET:
C**
C**  - REDISTRIBUTIONS OF SOURCE CODE MUST RETAIN THIS NOTICE, THIS LIST
C**    OF CONDITIONS AND THE FOLLOWING DISCLAIMER.
C**
C**  - REDISTRIBUTIONS IN BINARY FORM MUST PROVIDE ACCESS TO THIS 
C**    NOTICE, THIS LIST OF CONDITIONS AND THE FOLLOWING DISCLAIMER, AND
C**    THE UNDERLYING SOURCE CODE.
C**
C**  - ALL MODIFICATIONS TO THIS SOFTWARE MUST BE CLEARLY DOCUMENTED, 
C**    AND ARE SOLELY THE RESPONSIBILITY OF THE AGENT MAKING THE 
C**    MODIFICATIONS.
C**
C**  - IF SIGNIFICANT MODIFICATIONS OR ENHANCEMENTS ARE MADE TO THIS
C**    SOFTWARE, THE FSL SOFTWARE POLICY MANAGER 
C**    (softwaremgr.fsl@noaa.gov) BE NOTIFIED.
C**
C**  THIS SOFTWARE AND ITS DOCUMENTATION ARE IN THE PUBLIC DOMAIN AND 
C**  ARE FURNISHED "AS IS."  THE AUTHORS, THE UNITED STATES GOVERNMENT,
C**  ITS INSTRUMENTALITIES, OFFICERS, EMPLOYEES, AND AGENTS MAKE NO 
C**  WARRANTY, EXPRESS OR IMPLIED, AS TO THE USEFULNESS OF THE SOFTWARE
C**  AND DOCUMENTATION FOR ANY PURPOSE.  THEY ASSUME NO RESPONSIBILITY 
C**  (1) FOR THE USE OF THE SOFTWARE AND DOCUMENTATION; OR (2) TO 
C**  PROVIDE TECHNICAL SUPPORT TO USERS.
C**---------------------------------------------------------------------
