        SUBROUTINE VCALGT (
*
*  inputs
*
     :                  OBSID, DKTBL, PATBL, HVTBL, SNTBL, GNTBL,
     :                  CVTBL, DTTBL, DKATBL, AARTBL,
     :                  DKDIM, PADIM, HVDIM, SNDIM, GNDIM,
     :                  CVDIM, DTDIM, DKADIM, AARDIM,
*
*  outputs
*
     :                  NDK, NPA, NHV, NSN, NGN, NCV, NDT, NDKAP, NAREA,
     :                  PADET, HVDET, GNDET, CVDET, DTDET,
     :                  DKAPER, SNAPER, DKAP, DKDET, DKNAME, AREAAP,
     :                  DKHV, HVHV, DTHV, GNGAIN, CVGAIN,
     :                  DKTYPE, PATYPE, HVTYPE, DTDISC,
     :                  DKBASE, PABASE, HVBASE, SNBSPT, SNBSEX, GNBASE,
     :                  CVBASE, DTBASE, AREA,
     :                  DKCOFF, PACOFF, HVCOFF, SNCOFF, GNCOFF, CVCOFF,
     :                  DTCOFF,
     :                  DKTMP0, PATMP0, HVTMP0, SNTMP0, GNTMP0, CVTMP0,
     :                  DTTMP0,
     :                  DKEP0, PAEP0, HVEP0, SNEP0, GNEP0, CVEP0,
     :                  STATUS)
*
*  Module Number:
*
*  Module Name: CALHSP
*
*  Keyphrase:
*  ----------
*  read tables necessary for the pipeline processing
*
*  Description:
*  ------------
*
*  FORTRAN Name: VCALGT.FOR
*
*  Keywords of Accessed Files and Tables:
*  --------------------------------------
*  Name                         I/O     Description / Comments
*
*  Subroutines Called:
*  -------------------
*  CDBS:
*       VGTDK, VGTPA, VGTHV, VGTSN, VGTGN, VGTCV, VGTDT, VGTAAR, VGTDKA
*  SDAS:
*       none
*  OTHERS:
*       None
*
*  History:
*  --------
*  Version      Date        Author          Description
*     1       08-01-88     J.-C. Hsu        Design and coding
*     2       01-11-89     J.-C. Hsu        no need for time bias
*     3       11-15-89     J.-C. Hsu        pass OBSID so it shows in the message
*-------------------------------------------------------------------------------
*
*== inputs:
*					--observation ID
        CHARACTER*(*)           OBSID, 
*                                       --file name of the dark signal table
     :				DKTBL,
*                                       --file name of the pre-amp noise table
     :                          PATBL,
*                                       --file name of the high voltage factor table
     :                          HVTBL,
*                                       --file name of the relative sensitivity
*                                       --table
     :                          SNTBL,
*                                       --file name of the gain factor table
     :                          GNTBL,
*                                       --file name of the CVC offset table
     :                          CVTBL,
*                                       --file name of the deadtime table
     :                          DTTBL,
*                                       --file name of the dark aperture translation
*                                       --table
     :                          DKATBL,
*                                       --file name of the aperture size table
     :                          AARTBL
*                                       --maximum dimensions of arrays
        INTEGER                 DKDIM, PADIM, HVDIM, SNDIM,
     :                          GNDIM, CVDIM, DTDIM, DKADIM, AARDIM
*
*== output:
*                                       --aperture names and dark aperture names
*                                       --in the dark aperture translation table
        CHARACTER*(*)           DKAP(1), DKNAME(1),
*                                       --aperture names in the aperture area
*                                       --table
     :                          AREAAP(1),
*                                       --aperture names in each calibration table
     :                          DKAPER(1), SNAPER(1),
*                                       --data types of each calibration table
     :                          DKTYPE(1), PATYPE(1), HVTYPE(1)
*                                       --detector ID in each calibration table
*                                       --(PA = pre-amp, HV = high voltage
*                                       --factor, CV = CVC offset, DT = dead
*                                       --time, DM = dummy, DK = dark signal,
*                                       --GN = gain factor, SN = relative
*                                       --sensitivity)
        INTEGER                 PADET(1), HVDET(1), GNDET(1),
     :                          CVDET(1), DTDET(1), DKDET(1),
*                                       --number of rows in dark aperture
*                                       --translation table
     :                          NDKAP,
*                                       --number of rows in aperture area table
     :                          NAREA,
*                                       --number of data entries in each
*                                       --calibration table
     :                          NDK, NHV, NPA, NSN, NGN, NCV, NDT
*                                       --high voltage settings in each
*                                       --calibration table
        REAL                    DKHV(1), HVHV(1), DTHV(1),
*                                       --gain settings in each calibration table
     :                          GNGAIN(1), CVGAIN(1),
*                                       --discriminator threshold settings in
*                                       --the dead time calibration table
     :                          DTDISC(1),
*                                       --aperture area in the aperture are table
     :                          AREA(1),
*                                       --base values of each calibration table
     :                          DKBASE(1), PABASE(1), HVBASE(1),
*                                       --relative sensitivity has two base
*                                       --values for each set of coefficients
     :                          SNBSPT(1), SNBSEX(1),
     :                          GNBASE(1), CVBASE(1),
     :                          DTBASE(1),
*                                       --polynominal coefficients of calibration
     :                          DKCOFF(16,1), PACOFF(16,1),
     :                          HVCOFF(16,1), SNCOFF(16,1),
     :                          GNCOFF(16,1), CVCOFF(16,1),
*                                       --deadtime temperature dependent coeff
     :                          DTCOFF(1),
*                                       --zero points of temperature in each
*                                       --calibration table
     :                          DKTMP0(1), PATMP0(1), HVTMP0(1),
     :                          SNTMP0(1), GNTMP0(1), CVTMP0(1),
     :                          DTTMP0(1)
*                                       --zero points of epoch in each
*                                       --calibration table
        DOUBLE PRECISION        DKEP0(1), PAEP0(1), HVEP0(1),
     :                          SNEP0(1), GNEP0(1), CVEP0(1)
*
*== local:
*                                       --return status
        INTEGER                 STATUS,
*                                       --return status
     :                          STAT(30),
*                                       --loop indices
     :                          I
*==========================begin iraf77.inc (without INTEGER*2)=================
*     Include file for the iraf77 FORTRAN interface to the IRAF VOS
*     Get IRAF common into main program
*
      LOGICAL MEMB(1)
      INTEGER MEMI(1)
      INTEGER MEML(1)
      REAL MEMR(1)
      DOUBLE PRECISION MEMD(1)
      COMPLEX MEMX(1)
      EQUIVALENCE (MEMB, MEMI, MEML, MEMR, MEMD, MEMX)
      COMMON /MEM/ MEMD
*
*     File I/O access modes
*
      INTEGER   RDONLY
      PARAMETER (RDONLY = 1)
      INTEGER   RDWRIT
      PARAMETER (RDWRIT = 2)
      INTEGER   WRONLY
      PARAMETER (WRONLY = 3)
      INTEGER   APPEND
      PARAMETER (APPEND = 4)
      INTEGER   NEWFIL
      PARAMETER (NEWFIL = 5)
      INTEGER   TMPFIL
      PARAMETER (TMPFIL = 6)
      INTEGER   NEWCPY
      PARAMETER (NEWCPY = 7)
      INTEGER   NEWIMG
      PARAMETER (NEWIMG = 5)
*
*     codes for data types
*
      INTEGER   TYBOOL
      PARAMETER (TYBOOL = 1)
      INTEGER   TYCHAR
      PARAMETER (TYCHAR = 2)
      INTEGER   TYSHOR
      PARAMETER (TYSHOR = 3)
      INTEGER   TYINT
      PARAMETER (TYINT = 4)
      INTEGER   TYLONG
      PARAMETER (TYLONG = 5)
      INTEGER   TYREAL
      PARAMETER (TYREAL = 6)
      INTEGER   TYDOUB
      PARAMETER (TYDOUB = 7)
      INTEGER   TYCPLX
      PARAMETER (TYCPLX = 8)
      INTEGER   TYUSHT
      PARAMETER (TYUSHT = 11)
      INTEGER   TYUBYT
      PARAMETER (TYUBYT = 12)
*
*     TYTEXT is a special code for the iraf77 interface; it is not in the VOS
*
      INTEGER TYTEXT
      PARAMETER (TYTEXT = 13)
*========================end iraf77.inc=========================================
*=========================begin hsp.inc=========================================
*                                       --status return code
        INTEGER         OK, ERRNUM(20)
*                                       --message destination and priority
        INTEGER         DEST, PRIO
        DATA OK /0/
        DATA ERRNUM /701, 702, 703, 704, 705, 706, 707, 708, 709, 710,
     :               711, 712, 713, 714, 715, 716, 717, 718, 719, 720/
        DATA DEST, PRIO /1, 0/
*=========================end hsp.inc===========================================
*-------------------------------------------------------------------------------
*
        CALL VGTDK (OBSID, DKTBL, DKDIM,    DKAPER, DKHV, DKTYPE,
     :                  DKBASE, DKCOFF, DKTMP0, DKEP0, NDK, STAT(1))
        CALL VGTPA (OBSID, PATBL, PADIM,    PADET, PATYPE,
     :                  PABASE, PACOFF, PATMP0, PAEP0, NPA, STAT(2))
        CALL VGTHV (OBSID, HVTBL, HVDIM,    HVDET, HVHV, HVTYPE,
     :                  HVBASE, HVCOFF, HVTMP0, HVEP0, NHV, STAT(3))
        CALL VGTSN (OBSID, SNTBL, SNDIM,    SNAPER, SNBSPT, SNBSEX,
     :                  SNCOFF, SNTMP0, SNEP0, NSN, STAT(4))
        CALL VGTGN (OBSID, GNTBL, GNDIM,    GNDET, GNGAIN,
     :                  GNBASE, GNCOFF, GNTMP0, GNEP0, NGN, STAT(5))
        CALL VGTCV (OBSID, CVTBL, CVDIM,    CVDET, CVGAIN,
     :                  CVBASE, CVCOFF, CVTMP0, CVEP0, NCV, STAT(6))
        CALL VGTDT (OBSID, DTTBL, DTDIM,    DTDET, DTHV, DTDISC, 
     :                  DTBASE, DTCOFF, DTTMP0, NDT, STAT(7))
        CALL VGTDKA (OBSID, DKATBL, DKADIM,    DKAP, DKDET, DKNAME,
     :                  NDKAP, STAT(8))
        CALL VGTAAR (OBSID, AARTBL, AARDIM,    AREAAP, AREA,
     :                  NAREA, STAT(9))
*
        DO 10 I = 1, 9
            IF (STAT(I) .NE. OK) THEN
                STATUS = ERRNUM(1)
                GO TO 999
            END IF
   10   CONTINUE
*
        STATUS = OK
        GO TO 1000
*
*  write error message
*
  999   CONTINUE
*
 1000   RETURN
        END
