C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LDM_SETF_PL      **
C**************************
C
C
      SUBROUTINE LDM_SETF_PL (IPACK, IPLATE,PAR, IS_PAR, CH_PAR,
     +                        ND_PAR, VALUE, MAXPK, MAXPL)
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: Set values for a plate based real parameter (for LDM_SET.. routines)
C
C ***** 'LDM' SERVICE ROUTINE ONLY *****
C
C Author:  John W. Campbell, June 1993
C
C Arguments:
C
      INTEGER IPACK
      INTEGER IPLATE
      INTEGER MAXPK
      INTEGER MAXPL
      REAL PAR(MAXPK,MAXPL)
      INTEGER IS_PAR(MAXPK,MAXPL)
      INTEGER CH_PAR(MAXPK,MAXPL)
      INTEGER ND_PAR(MAXPK,MAXPL)
      REAL VALUE

C  IPACK     (R)   Pack number, 0=all packs
C  IPLATE    (R)   Plate number, 0=all plates
C  PAR       (W)   Array containing parameter values to be set
C  IS_PAR    (W)   Array containing IS flags to be set
C  CH_PAR    (W)   Array containing CH flags to be set
C  ND_PAR    (W)   Array containing ND flags to be set
C  VALUE     (R)   Value to be set
C  MAXPK     (R)   Packs array dimension
C  MAXPL     (R)   Plates array dimension
C
C====== GLOBALS:
C
      INCLUDE 'ldm_data.finc'
C
C====== LOCALS:
C
      INTEGER I
      INTEGER J
C
C-------------------------------------------------------------------------------
C
      IF (IPACK.EQ.0) THEN
         IF (IPLATE.EQ.0) THEN
            DO 100 I = 1, MAXPK
               DO 50 J = 1, MAXPL
                 PAR(I,J) = VALUE
                  IS_PAR(I,J) = 2
                  CH_PAR(I,J) = CH_MASK
                  ND_PAR(I,J) = -1000
50             CONTINUE
100         CONTINUE
         ELSE
            DO 150 I = 1, MAXPK
                PAR(I,IPLATE) = VALUE
                IS_PAR(I,IPLATE) = 2
                CH_PAR(I,IPLATE) = CH_MASK
                ND_PAR(I,IPLATE) = -1000
150         CONTINUE
         END IF
      ELSE
         IF (IPLATE.EQ.0) THEN
            DO 200 J = 1, MAXPL
               PAR(IPACK,J) = VALUE
               IS_PAR(IPACK,J) = 2
               CH_PAR(IPACK,J) = CH_MASK
               ND_PAR(IPACK,J) = -1000
200         CONTINUE
         ELSE
            PAR(IPACK,IPLATE) = VALUE
            IS_PAR(IPACK,IPLATE) = 1
            CH_PAR(IPACK,IPLATE) = CH_MASK
            ND_PAR(IPACK,IPLATE) = -1000
         END IF
      END IF
      RETURN
      END
