C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LDM_CHK_SPL      **
C**************************
C
C
      SUBROUTINE LDM_CHK_SPL (IPACK, IPLATE, IERR, ERRSTR)
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: Check validity of pack and plate definition for 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 IERR
      CHARACTER*(*) ERRSTR

C  IPACK     (R)   Pack number, 0=all packs
C  IPLATE    (R)   Plate number, 0=all plates
C  IERR      (W)   Error flag =0 OK
C                             =-1 Invalid pack number
C                             =-2 Invalid plate number
C  ERRSTR    (W)   Error description string if error found
C
C====== GLOBALS:
C
      INCLUDE 'ldm_data.finc'
      EXTERNAL LDM_BDAT
C
C====== LOCALS:
C

C
C-------------------------------------------------------------------------------
C
      IERR = 0
      ERRSTR = ' '
      IF (IPACK.LT.0) THEN
         IERR = -1
         ERRSTR = 'Pack number must be >=0'
         RETURN
      END IF
      IF (IPACK.GT.LDM_MAXPK) THEN
         IERR = -1
         ERRSTR = 'Pack number exceeds program limit of'
         CALL STR_ADDI (ERRSTR, LDM_MAXPK, 1)
         RETURN
      END IF
      IF (IPLATE.LT.0) THEN
         IERR = -2
         ERRSTR = 'Plate number must be >=0'
         RETURN
      END IF
      IF (IPLATE.GT.LDM_MAXPL) THEN
         IERR = -2
         ERRSTR = 'Plate number exceeds program limit of'
         CALL STR_ADDI (ERRSTR, LDM_MAXPL, 1)
         RETURN
      END IF
      RETURN
      END
