Index Page
cspice_ekappr
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_EKAPPR appends a new, empty record at the end of a specified
   EK segment.

   For important details concerning this module's function, please refer to
   the CSPICE routine ekappr_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
               for the new record
   
   the call:
   
      cspice_ekappr, handle, segno, recno
   
   returns:
   
      recno    the scalar integer indicating the index of the new
               record
   

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.

     
      ;;
      ;; Initialize needed parameters.
      ;;
      SPICEFALSE = 0B
      SPICETRUE  = 1B
      EKNAME     = "ekacex_t.ek"
      FNMLEN     = 50
      IFNAME     = "Test EK"
      LNMLEN     = 50
      LSK        = "standard.tm"
      NCOLS      = 6
      NRESVC     = 0
      NROWS      = 9
      TABLE       = "DATAORDERS"
      
      ;;
      ;; Load a leapseconds kernel for UTC/ET conversion.
      ;;
      cspice_furnsh, LSK
      
      ;;
      ;; 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
      
      cnames = strarr( NCOLS )
      cdecls = strarr( NCOLS )
      
      cnames[0] = "ORDER_ID" 
      cdecls[0] = "DATATYPE = INTEGER, INDEXED = TRUE"
      
      cnames[1] = "CUSTOMER_ID"
      cdecls[1] = "DATATYPE = INTEGER, INDEXED = TRUE"
      
      cnames[2] = "LAST_NAME" 
      cdecls[2] = "DATATYPE = CHARACTER*(*), INDEXED  = TRUE"
      
      cnames[3] = "FIRST_NAME" 
      cdecls[3] = "DATATYPE = CHARACTER*(*), INDEXED  = TRUE"
      
      cnames[4] = "ORDER_DATE"
      cdecls[4] = "DATATYPE = TIME, INDEXED  = TRUE" 
      
      cnames[5] = "COST"
      cdecls[5] = "DATATYPE = DOUBLE PRECISION, "    +$
                  "INDEXED  = TRUE, NULLS_OK = TRUE"
         
      ;;
      ;; Start the segment.  We presume the number of  rows 
      ;; of data is known in advance. 
      ;;
      cspice_ekbseg, handle,  TABLE,   NCOLS,  $
                     cnames,  cdecls,  segno
      
      ;;
      ;; Prepare for an append operation to segment segno.
      ;;
      cspice_ekappr, handle, segno, recno
      
      ;;
      ;; At this point, arrays containing data for the 
      ;; segment's columns may be filled in.  The names 
      ;; of the data arrays are shown below. 
      ;;
      ;;   Column           Data array 
      ;;
      ;;   "ORDER_ID"       ordids 
      ;;   "CUSTOMER_ID"    cstids 
      ;;   "LAST_NAME"      lnames 
      ;;   "FIRST_NAME"     fnames 
      ;;   "ORDER_DATE"     odates 
      ;;   "COST"           costs 
      ;;
      ;; The null flags array indicates which entries are null. 
      ;; It is ignored for columns that don't allow null 
      ;; values.  In this case, only the COST column allows 
      ;; nulls. 
      ;;
      ;; Fill in data arrays and null flag arrays here.  This code
      ;; section would normally be replaced by calls to user functions
      ;; returning column values.
      ;;
      ordids = lonarr( NROWS)
      cstids = lonarr( NROWS)
      costs  = dblarr( NROWS)
      ets    = dblarr( NROWS)
      fnames = strarr( NROWS)
      lnames = strarr( NROWS)
      
      for i = 0, (NROWS-1) do begin
      
         ordids[i] =  i
         cstids[i] =  i*100
         costs [i] =  double(100*i)
         fnames[i] = "Order " + string(i) + " Customer first name"
         lnames[i] = "Order " + string(i) + " Customer last name"
      
         date_string = '2001 Mar ' + string(i)
      
         cspice_utc2et, date_string, et
         ets[i] = et
      
      endfor
      
      nlflgs = SPICEFALSE   
      
      ;;
      ;; Add the columns of data to the segment.  All of the 
      ;; data for each column is written in one shot. Note,
      ;; the interface code signals an error if the null flag
      ;; for a column, 'nlflgs', has value SPICETRUE while the 
      ;; declaration for the column lacks a NULLS_OK = TRUE 
      ;; assignment.
      ;;
      cspice_ekacei, handle, segno, recno, "order_id", NROWS, $
                     ordids, nlflgs
      
      cspice_ekacei, handle, segno, recno, "customer_id", NROWS, $
                     cstids, nlflgs
      
      cspice_ekacec, handle, segno, recno, "last_name", NROWS, $
                     LNMLEN, lnames, nlflgs
      
      cspice_ekacec, handle, segno, recno, "first_name", NROWS, $
                     FNMLEN, fnames,  nlflgs 
      
      cspice_ekaced, handle, segno, recno, "order_date", NROWS, $
                     ets, nlflgs
      
      cspice_ekaced, handle, segno, recno, "cost", NROWS, $
                     costs, nlflgs 
      
      ;;
      ;; The file must be closed by a call to cspice_ekcls
      ;;
      cspice_ekcls, handle
      cspice_unload, 'standard.tm'

Particulars


   None.

Required Reading


   ICY.REQ
   EK.REQ

Version


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

Index_Entries

 
   append record to EK segment 
 



Wed Apr  5 17:58:00 2017