      SUBROUTINE GMVALS(UNITNM,PARM,HEMIS,BLCK,VALUE,ERROR)
C**********************************************************************
C
C   NAME- GMVALS
C
C   LANGUAGE- FORTRAN 77      TYPE- SUBROUTINE       COMPUTER- CRAY   
C
C   VERSION- 1.0  DATE- 08/22/91   PROGRAMMER- JEFFREY R. JONES (SMSRC)
C   VERSION- 3.0  DATE- 05/21/96   PROGRAMMER- ALEX POZDNYAK (FDC)     
C     FOR REHOSTING TO THE CRAY, CHANGED ALL I*4 DECLARATIONS TO
C     INTEGER, ALL R*4 TO REAL, AND ALL LOG*4 DECLARATIONS TO
C     LOGICAL. 
C   VERSION- 3.1  DATE- 03/06/98   PROGRAMMER- LEAH WILSON (RAYTHEON STX)
C   VERSION- 3.2  DATE- 11/03/98   PROGRAMMER- BRIAN BARIL (RAYTHEON ITSS)
C
C   DESCRIPTION- THIS ROUTINE TAKES AS INPUT THE MAP TYPE (PARAMETER
C                BEING REQUESTED), THE HEMISPHERE NAME (NORTHERN OR
C                SOUTHERN), AND THE BLOCK NUMBER AND RETURNS THE VALUES
C                STORED IN THIS PARTICULAR MAP FOR THE GIVEN BLOCK.
C                GMVALS CALLS THE CDB MANAGER ROUTINE RGTCDB TO RETRIEVE
C                THE PARAMETER'S VALUE OF PARAMETER FOR THE GIVEN
C                BLOCK. BEFORE THIS CAN BE DONE, A FULLY QUALIFIED NAME
C                FOR THE VALUES THAT REQUIRE RETRIEVAL FROM THE MMCDB
C                MUST BE CREATED.  GMVALS DOES THIS BY CALLING MKNAME.
C                THE VALUES ARE RETURNED BY GMVALS IN THE FORM OF
C                A TWO-DIMENSIONAL ARRAY CONTAINING A FULL BLOCKS WORTH
C                OF DATA. ANY ERROR THAT OCCURS IN THE CDB MANAGER
C                ROUTINES CAUSES GMVAL$ TO BE CALLED. GMVAL$ SETS THE
C                ERROR RETURN CODE AND CALLS THE CDB MANAGER ROUTINE
C                ERRMSG TO WRITE THE ERROR TO THE MAINTENANCE MESSAGE
C                LOG.
C   VERSION- 3.1 IN-LINE MKNAME AND REMOVE GMVAL$, REPLACING W/KIDS.
C   VERSION- 3.2 REMOVED ALL REFERENCES TO OLD FAU'S.  REPLACED RGTCDB
C                WITH REALCOEF.
C
C   CALLING SEQUENCE PARAMETERS-
C
C      ARGUMENTS  TYPE  I/O             DESCRIPTION
C      ---------  ----  ---  ------------------------------------------
C      UNITNM     INT    I   THE MAPPARM CDB UNIT NUMBER
C
C      PARM       CH*8   I   THE PARAMETER FOR WHICH A VALUE IS BEING
C                            REQUESTED. THIS IS USED AS THE FIRST LEVEL
C                            QUALIFIER FOR MAP COEFFICIENT NAMES IN THE
C                            CDB.
C
C      HEMIS      CH*8   I   THE HEMISPHERE OF THE MAP. THIS IS USED AS
C                            THE SECOND LEVEL QUALIFIER OF THE MAP IN
C                            THE CDB.
C
C      BLCK       INT    I   THE BLOCK IN WHICH THE DATA IS HELD.
C
C      VALUE      REAL   O   THE VALUE HELD FOR THAT LOCATION IN THE
C                            MAP.
C
C      ERROR      INT    O   THE ERROR RETURN CODE.
C                                 0 - SUCCESSFUL COMPLETION.
C                                99 - FATAL ERROR.
C
C   SUBROUTINES CALLED-  RGTCDB, KIDS
C
C   COMMON AREA PARAMETERS-
C
      INCLUDE 'MAPCST'
      INCLUDE 'SPGUNT'
C
C   LOCAL PARAMETERS-
C
C      ARGUMENTS  TYPE  I/O             DESCRIPTION
C      ---------  ----  ---  ------------------------------------------
C      COEFNM     CH*8        HOLDS THE COEFFICIENT NAME PARAMETER
C                             IN THE CDB.
C      CHROLD     CH*1        HOLDS THE CHARACTER VALUES OF THE
C                             TOO_OLD_FLAG AS READ FROM THE MAP.
C      LOGOLD     LOG         HOLDS THE LOGICAL VALUES OF THE
C                             TOO_OLD_FLAG AS EQUIVALENCED FROM CHROLD.
C      STATUS     INT         STATUS CODE RETURNED FROM CDB ROUTINES.
C      KMSG      CH*100       KIDS MESSAGE BUFFER.
C
C   SUBPROGRAMS CALLED-  KIDS
C
C***********************************************************************
C
C   EXIT STATES-
C      99 - FATAL ERROR: AN ERROR OCCURRED IN THE CDB MANAGER ROUTINES.
C
C   COMMENTS-
C      THIS ROUTINE CALLS CDB MANAGER ROUTINES TO ACCESS THE MAP
C      MANAGERS CDB.
C
C**********************************************************************
C
      CHARACTER*8 PARM, HEMIS,COEFNM
      CHARACTER*100 KMSG
      INTEGER     BLCK, ERROR
      INTEGER     STATUS,UNITNM
      REAL        VALUE(WMESHC, WMESHC)
C*************** PORTING CRAY TO IBMSP*******************
C CONVERSION FROM CHARACTER LITERAL WAS NOT PERTMITTED
C i.e SUBNAM was declared as character*8
C
      CHARACTER*8 SUBNAM
C*************************
C
C     INITIALIZE VARIABLES.
C
C     NOTE:  VALUE IS NOT INITIALIZED HERE TO SAVE
C            PROCESSING TIME.  IT IS SET IN RGTCDB.
C
      STATUS = 0
      ERROR = 0
C
C     CREATE A FULLY QUALIFIED NAME FOR THE MAPS VALUES.
C
C     SEE IF BLOCK NUMBER EXISTS.
C
      IF (BLCK .GT. 0 ) THEN
C
C         BLOCK NUMBER EXISTS. INCLUDE IN NAME
C

         WRITE(COEFNM,10)'VAL',BLCK
   10    FORMAT (A3,I5.5)
C
      ELSE
C
C        BLOCK NUMBER DOES NOT EXIST.
C
         WRITE(COEFNM,20)'VAL     '
   20    FORMAT (A8)
C
      END IF
C
C     GET THE MAPS VALUES FROM THE MAP.
C
      CALL REALCOEF(UNITNM,PARM,HEMIS,COEFNM,WMESHC, WMESHC, 0, 0, 
     1              VALUE,'GET',STATUS)
      IF (STATUS.NE.0) GOTO 30

C
C     RETURN TO CALLING ROUTINE NORMALLY
C
      RETURN
C
C     WRITE ERROR MESSAGE
C
   30 SUBNAM = 'SPGDVR'
      KMSG(1:50)='*WARNING* Error retrieving Mapped Parameter co'
      KMSG(51:100)='ef:                                '
      KMSG(55:65) = PARM
      KMSG(65:75) = HEMIS
      KMSG(75:90) = COEFNM
      CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
      ERROR = 99
C
C     RETURN TO ERROR HANDLING SECTION OF CALLING ROUTINE.
C
      RETURN
C
      END
C
