C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C                .      .    .                                       .
C SUBPROGRAM:    MSETSATRADPVDR SET SATRAD PVDR TO ENABLED/DISABLED
C   PRGMMR: L. BENJAMIN      ORG: FSL        DATE: 05-10-25
C
C ABSTRACT: ENABLE OR DISABLE ONE MADIS DATA PROVIDER.
C
C PROGRAM HISTORY LOG:
C   05-10-25  L. BENJAMIN ORIGINAL VERSION
C
C USAGE:    CALL MSETSATRADPVDR (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-POES'
C     (BOTH POES).
C   - THE MADISCOM PROVIDER ARRAYS (NPVD, PVDNAME, ETC.) HAVE SATRAD
C     PROVIDERS IN ROW 7.
C
C ATTRIBUTES:
C   LANGUAGE: FORTRAN-77 + EXTENSIONS
C   MACHINE:  UNIX
C$$$

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

      STATUS = SUCCESS_P

C     -----------------------------------------------------------------
C     IF 'ALL-POES', WE'LL USE FLAG FOR ALL PROVIDERS (E.G., POES
C     SATELLITES IDENTIFIED BY NUMBER, I.E., NOAA-16) ALREADY 
C     IDENTIFIED, AND USE IT FOR ANY NEW PROVIDERS THAT HAVE ALREADY 
C     BEEN SPECIFIED VIA AN EARLIER CALL TO THIS ROUTINE, BUT THAT 
C     HAVEN'T YET SHOWN UP AND GOTTEN ENABLED/DISABLED.
C     -----------------------------------------------------------------
      IF(PROVDR_L.EQ.'ALL-POES')THEN
         SATRDSET_ENBL(MAX_SATRDSET_P) = FLAG

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

         ALL_ENBL(7) = FLAG

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

      ELSE

C     -----------------------------------------------------------------
C     MAKE SURE THE DATASET ENABLE FLAGS ARE SET PROPERLY TO HANDLE
C     THE PROVIDERS (SOME DATASETS CONTAIN MORE THAN ONE PROVIDER,
C     SOME PROVIDERS SPAN MORE THAN ONE DATASET).  NOTE THAT WE DO
C     THIS OUTSIDE OF THE FIND THE PROVIDER LOOP BECAUSE WE DON'T KNOW
C     THAT WE'LL KNOW ALL THE PROVIDER NAMES AT THIS POINT.
C
C     NOTE THAT THE NOAA-NN PROVIDER NAME ASSUMES A 2-DIGIT NOAA
C     NUMBER -- IF NOAA-17 IS AVAILABLE (CURRENTLY IT'S NOT IN USE)
C     IT SHOULD BE SPECIFIED AS NOAA-16.
C     -----------------------------------------------------------------
         IF(PROVDR_L(1:4).EQ.'NOAA')THEN
            SATRDSET_ENBL(MAX_SATRDSET_P) = FLAG
         ENDIF

         DO 5 I = 1, NPVD(7)

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

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