Index Page
cspice_ekucec
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_EKUCEC updates a character column entry in a specified
   EK record.

   For important details concerning this module's function, please refer to
   the CSPICE routine ekucec_c.

I/O


   Given:

      handle      the scalar integer referring to an EK file open for
                  write access.

      segno       the scalar integer indicating EK segment number
                  of the record of interest.

      recno       the scalar integer identifying the index for record
                  of interest.

      column      the string scalar name of the column for the
                  record of interest.

      nvals       the integer number of entries from 'cvals' to update.

      cvals_len   a scalar integer defining the maximum length of a
                  string in 'cvals'.

      cvals       an array of strings containing the data values to
                  update to the record in 'column'.

                     Note: 'nvals' specifies the number of 'cvals'
                     entries written to the updated record.

      isnull      a scalar boolean flagging whether the entry is null

   the call:

      cspice_ekucec, handle, segno    , recno, column, $
                     nvals , cvals_len, cvals, isnull

   updates 'nvals' of 'cvals' to with length 'cvals_len' to
   column 'column' in segment 'segno', record 'recno', of the
   EK file referred to by 'handle'.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.


      ;;
      ;; Constants
      ;;
      EKNAME = "ekucec.ek"
      IFNAME = "Test EK"
      NCOLS  = 2
      NROWS  = 6
      NRESVC = 0
      TABLE  = "CHR_DATA"
      CVLEN  = 10
      MAXVAL = 10
      cvals  = strarr( MAXVAL )

      ;;
      ;; Open a new EK file.  For simplicity, we won't
      ;; reserve space for the comment area, so the
      ;; number of reserved comment characters is zero.
      ;; The constant IFNAME is the internal file name.
      ;;
      if ( cspice_exists (EKNAME) ) then begin
         file_delete, EKNAME
      endif

      cspice_ekopn, EKNAME, IFNAME, NRESVC, handle

      ;;
      ;;   Set up the table and column names and declarations
      ;;   for the CHR_DATA segment.  We'll index all of
      ;;   the columns.  All columns are scalar, so we omit
      ;;   the size declaration.
      ;;
      cdecls = strarr(NCOLS)
      cnames = strarr(NCOLS)

      cnames[0] = "CHR_COL_1"
      cdecls[0] = "DATATYPE = CHARACTER*(*), INDEXED = TRUE,"+$
                  " NULLS_OK = TRUE"

      cnames[1] = "CHR_COL_2"
      cdecls[1] = "DATATYPE = CHARACTER*(9), SIZE = VARIABLE,"+$
                  " NULLS_OK = TRUE"

      ;;
      ;; Start the segment.
      ;;
      cspice_ekbseg, handle, TABLE, NCOLS, cnames, cdecls, segno

      for i = 0, (NROWS-1) do begin

         cspice_ekappr, handle, segno, recno

         isnull   =  ( i EQ 1 )

         cvals[0] = string(i)
         cspice_ekacec, handle, segno, recno, cnames[0], $
                        1     , CVLEN, cvals, isnull

         ;;
         ;; Array-valued columns follow.
         ;;
         cvals[0] = string( 10*i )
         cvals[1] = string((10*i) + 1)
         cvals[2] = string((10*i) + 2)
         cvals[3] = string((10*i) + 3)
         cspice_ekacec, handle, segno, recno, cnames[1], $
                        4     , CVLEN, cvals, isnull

      endfor

      ;;
      ;; End the file.
      ;;
      cspice_ekcls, handle


      ;;
      ;; Open the EK for write access.
      ;;
      cspice_ekopw, EKNAME, handle

      ;;
      ;; Negate the values in the odd-numbered records
      ;; using the update routines."
      ;;
      for i = 1, (NROWS-1), 2 do begin

         recno    = i
         isnull   =  ( i EQ 1 )

         cvals[0] = string(-i)
         cspice_ekucec, handle, segno, recno, cnames[0], $
                        1     , CVLEN, cvals, isnull

         ;;
         ;; Array-valued columns follow.
         ;;
         cvals[0] = string( -10*i )
         cvals[1] = string(-((10*i) + 1))
         cvals[2] = string(-((10*i) + 2))
         cvals[3] = string(-((10*i) + 3))
         cspice_ekucec, handle, segno, recno, cnames[1], $
                        4     , CVLEN, cvals, isnull

      endfor

      ;;
      ;; End the file.
      ;;
      cspice_ekcls, handle


      ;;
      ;; Open the created file. Show the values added.
      ;;
      cspice_ekopr, EKNAME, handle

      for i = 0, (NROWS-1) do begin

         cspice_ekrcec, handle, segno, i, cnames[0], MAXVAL, $
                        CVLEN, cvals,  isnull

         if ( NOT isnull ) then begin
            print, 'Data from column: ',cnames[0],'   record number: ',i
            print, cvals
            print
         endif

         ;;
         ;; Array-valued columns follow.
         ;;
         cspice_ekrcec, handle, segno, i, cnames[1],  MAXVAL, $
                        CVLEN, cvals,  isnull

         if ( NOT isnull ) then begin
            print, 'Data from column: ',cnames[1], '   record number: ',i
            print, cvals
            print
         endif

      endfor

      ;;
      ;; End the file.
      ;;
      cspice_ekcls, handle

   IDL outputs:

      Data from column: CHR_COL_1   record number:        0
          0

      Data from column: CHR_COL_2   record number:        0
          0         1         2         3

      Data from column: CHR_COL_1   record number:        2
          2

      Data from column: CHR_COL_2   record number:        2
         20        21        22        23

      Data from column: CHR_COL_1   record number:        3
         -3

      Data from column: CHR_COL_2   record number:        3
        -30       -31       -32       -33

      Data from column: CHR_COL_1   record number:        4
          4

      Data from column: CHR_COL_2   record number:        4
         40        41        42        43

      Data from column: CHR_COL_1   record number:        5
         -5

      Data from column: CHR_COL_2   record number:        5
        -50       -51       -52       -53

   Note record 1 does not appear due to setting the 'isnull' flag
   to true for that record.

   Notice the odd value record numbers have negative values
   as a result of the update calls.

Particulars


   None.

Required Reading


   ICY.REQ
   EK.REQ

Version


   -Icy Version 1.0.1, 13-JUN-2010, EDW (JPL)

      Minor edit to code comments eliminating typo.

   -Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)

Index_Entries


   replace character entry in an EK column




Wed Apr  5 17:58:01 2017