*-----------------------------------------------------------------------
      subroutine nxvgac(ncdfid,cvname,cvalue)

      include   '/usr/local/include/netcdf.inc'

      character cvname*(*),cvalue*(*)

      integer   istart(MAXVDIMS),icount(MAXVDIMS),ivdims(MAXVDIMS)
      character cvtemp*(MAXNCNAM)


      nvarid=ncvid(ncdfid,cvname,ircode)
      if (ircode.ne.0) call msgdmp('e','nxvgac','error in ncvid.')

      call ncvinq(ncdfid,nvarid,cvtemp,ivtype,nvdims,ivdims,nvarat,
     +     ircode)
      if (ircode.ne.0) call msgdmp('e','nxvgac','error in ncvinq.')

      lencvl=1
      do 10 n=1,nvdims
        istart(n)=1
        call ncdinq(ncdfid,ivdims(n),cvtemp,icount(n),ircode)
        if (ircode.ne.0) call msgdmp('e','nxvgac','error in ncdinq.')
        lencvl=lencvl*icount(n)
   10 continue

      if (lencvl.eq.0)
     +     call msgdmp('e','nxvgac','unlimited dimension size exists.')

      call ncvgtc(ncdfid,nvarid,istart,icount,cvalue,lencvl,ircode)
      if (ircode.ne.0) call msgdmp('e','nxvgac','error in ncvgtc.')

      end
