
C******************************************************
C**  <<<<<<<<<<< 'LDM' SERVICE ROUTINES >>>>>>>>>>>  **
C******************************************************
C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LDM_CHK_SPK      **
C**************************
C
C
      SUBROUTINE LDM_CHK_SPK (IPACK, IERR, ERRSTR)
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: Check validity of pack 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 IERR
      CHARACTER*(*) ERRSTR

C  IPACK     (R)   Pack number, 0=all packs
C  IERR      (W)   Error flag =0 OK
C                             =-1 Invalid pack 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
      RETURN
      END
