C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C                .      .    .                                       .
C SUBPROGRAM:    MSETRDMTRPVDR SET RDMTR PROVIDER TO ENABLED/DISABLED
C   PRGMMR: M. BARTH         ORG: FSL        DATE: 03-07-03
C
C ABSTRACT: ENABLE OR DISABLE ONE MADIS DATA PROVIDER.
C
C PROGRAM HISTORY LOG:
C   03-07-03  M. BARTH    ORIGINAL VERSION
C
C USAGE:    CALL MSETRDMTRPVDR (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-RDMTR' 
C   - THE MADISCOM PROVIDER ARRAYS (NPVD, PVDNAME, ETC.) HAVE RDMTR
C     PROVIDERS IN ROW 4.
C
C ATTRIBUTES:
C   LANGUAGE: FORTRAN-77 + EXTENSIONS
C   MACHINE:  UNIX
C$$$

      SUBROUTINE MSETRDMTRPVDR(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(UAPT_INIT(RDMTR_DS_P).NE.INIT_P)THEN
         STATUS = SELSUB_NOTINIT_P
         CALL MERROR('MSETRDMTRPVDR: SELECTED SUBSYSTEM NOT '//
     1               'INITIALIZED - RDMTR')
         GO TO 900
      ENDIF

      STATUS = SUCCESS_P

      IF(PROVDR_L.EQ.'ALL-RDMTR ')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 3 I = 1, NPVD(4)
            PROVDR_ENBL(I,4) = FLAG
 3       CONTINUE

         ALL_ENBL(4) = FLAG

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

      ELSE

         DO 5 I = 1, NPVD(4)

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

               PROVDR_ENBL(I,4) = 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(4).NE.MAX_SUBSRC_P)THEN
               
            NNEWPVD(4) = NNEWPVD(4) + 1
            NEWPVDNAME(NNEWPVD(4),4) = PROVDR_L
            NEW_ENBL(NNEWPVD(4),4) = 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_UAPT_ATIME(RDMTR_DS_P) = '         '

      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**---------------------------------------------------------------------
