C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LDM_SAME_PL      **
C**************************
C
C
      LOGICAL FUNCTION LDM_SAME_PL (KEYWORD, NPK, NPL)
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: See if all values are the same for a plate dependent parameter
C          (integer or real parameter values)
C
C ***** 'LDM' SERVICE ROUTINE ONLY ****
C
C Author:  John W. Campbell, June 1993
C
C Arguments:
C
      CHARACTER*(*) KEYWORD
      INTEGER NPK
      INTEGER NPL

C KEYWORD  (R)   Parameter name keyword (full)
C NPK      (R)   Number of packs (minimum 1)
C NPL      (R)   Number of plates
C
C====== Parameter statements
C 

C
C====== GLOBALS:
C

C
C====== FUNCTION TYPES:
C
      
C
C====== LOCALS:
C
      INTEGER I
      INTEGER J
      INTEGER IVAL
      INTEGER ND
      INTEGER ITYP
      INTEGER IFLAG
      INTEGER IERR
      INTEGER IVAL_REF
      CHARACTER*1 VALSTR
      CHARACTER*1 ERRSTR
      REAL VALUE
      REAL VREF
      REAL EPS

C     INTEGER I            !Packs loop variable
C     INTEGER J            !Plates loop variable
C     INTEGER IVAL         !Integer value of parameter
C     INTEGER ND           !No. of decimal placed for parameter value print
C     INTEGER ITYP         !Parameter type flag from LDM_GET
C     INTEGER IFLAG        !Parameter value status flag from LDM_GET
C     INTEGER IERR         !Error flag from LDM_GET
C     INTEGER IVAL_REF     !Reference value (integer)
C     CHARACTER*1 VALSTR   !Parameter value string (treated as dummy here)
C     CHARACTER*1 ERRSTR   !Error return string (treated as dummy here)
C     REAL VALUE           !Real value of parameter
C     REAL VREF            !Reference value (real)
C     REAL EPS             !Small difference for 'equal' values test
C
C-------------------------------------------------------------------------------
C
C
C====== See if same for all packs and plates
C
      LDM_SAME_PL = .TRUE.
      CALL LDM_GET (KEYWORD, 1, 1, VALSTR, VREF, ND, IVAL_REF,
     +              IFLAG, ITYP, IERR, ERRSTR)
      IF (ITYP.EQ.3) THEN
         EPS = 1.0E-09
         DO 200 I = 1, NPK
            DO 150 J = 1, NPL
               CALL LDM_GET (KEYWORD, I, J, VALSTR, VALUE, ND, IVAL,
     +                 IFLAG, ITYP, IERR, ERRSTR)
               IF (ABS(VALUE-VREF).GT.EPS) GO TO 400
150         CONTINUE
200      CONTINUE
      ELSE
         DO 300 I = 1, NPK
            DO 250 J = 1, NPL
               CALL LDM_GET (KEYWORD, I, J, VALSTR, VALUE, ND, IVAL,
     +                 IFLAG, ITYP, IERR, ERRSTR)
               IF (IVAL.NE.IVAL_REF) GO TO 400
250         CONTINUE
300      CONTINUE
      END IF
      RETURN
400   LDM_SAME_PL = .FALSE.
      RETURN
      END
