C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C****************************
C**     LDM_GET_PID        **
C****************************
C
C
CD-Doc:
C PACK_id          SUBROUTINE LDM_GET_PID (IPACK, IVAL, IFLAG, 
C                 +                        IERR, ERRSTR)
CD-end
      SUBROUTINE LDM_GET_PID (IPACK, IVAL, IFLAG, IERR, ERRSTR)
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: Get value of pack dependent integer parameter PACK_ID
C
C Author:  John W. Campbell, June 1993
C
C Arguments:
C
      INTEGER IPACK
      INTEGER IVAL
      INTEGER IFLAG
      INTEGER IERR
      CHARACTER*(*) ERRSTR

C  IPACK     (R)   Pack number (explicit)
C  IVAL      (W)   Returns the pack id. number
C  IFLAG     (W)   Flag = -1 undefined value
C                       =  0 default value
C                       =  1 value set explicitly
C                       =  2 value set globally
C  IERR      (W)   Error flag = 0 OK
C                             =-1 Invalid pack number
C  ERRSTR    (W)   Error string if error found
C
C====== GLOBALS:
C
      INCLUDE 'ldm_data.finc'
      EXTERNAL LDM_BDAT
C
C====== LOCALS:
C
      INTEGER I
C
C-------------------------------------------------------------------------------
C
      IF (.NOT.INIT_PID) THEN
         CALL LDM_DF_PID (0, IERR, ERRSTR, LDM_MAXPK)
         INIT_PID = .TRUE.
         DO 10 I = 1, LDM_MAXPK
            CH_PID(I) = 0
10       CONTINUE
      END IF
      CALL LDM_CHK_GPK (IPACK, IERR, ERRSTR)
      IF (IERR.NE.0) RETURN
      IVAL = PID(IPACK)
      IFLAG = IS_PID(IPACK)
      RETURN
      END
