*-----------------------------------------------------------------------
      subroutine nxagtc(ncdfid,caname,cvalue)

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

      character caname*(*),cvalue*(*)

      character cvtemp*(MAXNCNAM)


      lencan=lenc(caname)
      lencva=lenc(cvalue)
      idxcol=indxcf(caname,lencan,1,':')

      if (idxcol.eq.1) then
        nvarid=NCGLOBAL
      else if (idxcol.gt.1) then
        nvarid=ncvid(ncdfid,caname(1:idxcol-1),ircode)
        if (ircode.ne.0) call msgdmp('e','nxagtc','error in ncvid.')
      else
        call msgdmp('e','nxagtc','error in attribute name.')
      end if

      call ncagtc(ncdfid,nvarid,caname(idxcol+1:lencan),
     +     cvtemp,MAXNCNAM,ircode)
      if (ircode.ne.0) call msgdmp('e','nxagtc','error in ncagtc.')

      cvalue=cvtemp

      end
