1 /* ekacec.f -- translated by f2c (version 19980913).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include "f2c.h"
7 
8 /* $Procedure     EKACEC ( EK, add character data to column ) */
ekacec_(integer * handle,integer * segno,integer * recno,char * column,integer * nvals,char * cvals,logical * isnull,ftnlen column_len,ftnlen cvals_len)9 /* Subroutine */ int ekacec_(integer *handle, integer *segno, integer *recno,
10 	char *column, integer *nvals, char *cvals, logical *isnull, ftnlen
11 	column_len, ftnlen cvals_len)
12 {
13     extern /* Subroutine */ int zzekcdsc_(integer *, integer *, char *,
14 	    integer *, ftnlen), zzeksdsc_(integer *, integer *, integer *),
15 	    zzektrdp_(integer *, integer *, integer *, integer *), chkin_(
16 	    char *, ftnlen), errch_(char *, char *, ftnlen, ftnlen);
17     integer class__, dtype;
18     extern logical failed_(void);
19     integer coldsc[11], segdsc[24];
20     extern /* Subroutine */ int errhan_(char *, integer *, ftnlen);
21     integer recptr;
22     extern /* Subroutine */ int setmsg_(char *, ftnlen), errint_(char *,
23 	    integer *, ftnlen), sigerr_(char *, ftnlen), chkout_(char *,
24 	    ftnlen), zzekad03_(integer *, integer *, integer *, integer *,
25 	    char *, logical *, ftnlen), zzekad06_(integer *, integer *,
26 	    integer *, integer *, integer *, char *, logical *, ftnlen);
27 
28 /* $ Abstract */
29 
30 /*     Add data to a character column in a specified EK record. */
31 
32 /* $ Disclaimer */
33 
34 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
35 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
36 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
37 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
38 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
39 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
40 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
41 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
42 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
43 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
44 
45 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
46 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
47 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
48 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
49 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
50 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
51 
52 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
53 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
54 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
55 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
56 
57 /* $ Required_Reading */
58 
59 /*     EK */
60 
61 /* $ Keywords */
62 
63 /*     EK */
64 /*     FILES */
65 /*     UTILITY */
66 
67 /* $ Declarations */
68 /* $ Disclaimer */
69 
70 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
71 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
72 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
73 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
74 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
75 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
76 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
77 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
78 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
79 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
80 
81 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
82 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
83 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
84 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
85 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
86 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
87 
88 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
89 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
90 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
91 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
92 
93 
94 /*     Include Section:  EK Column Descriptor Parameters */
95 
96 /*        ekcoldsc.inc Version 6    23-AUG-1995 (NJB) */
97 
98 
99 /*     Note:  The column descriptor size parameter CDSCSZ  is */
100 /*     declared separately in the include section CDSIZE$INC.FOR. */
101 
102 /*     Offset of column descriptors, relative to start of segment */
103 /*     integer address range.  This number, when added to the last */
104 /*     integer address preceding the segment, yields the DAS integer */
105 /*     base address of the first column descriptor.  Currently, this */
106 /*     offset is exactly the size of a segment descriptor.  The */
107 /*     parameter SDSCSZ, which defines the size of a segment descriptor, */
108 /*     is declared in the include file eksegdsc.inc. */
109 
110 
111 /*     Size of column descriptor */
112 
113 
114 /*     Indices of various pieces of column descriptors: */
115 
116 
117 /*     CLSIDX is the index of the column's class code.  (We use the */
118 /*     word `class' to distinguish this item from the column's data */
119 /*     type.) */
120 
121 
122 /*     TYPIDX is the index of the column's data type code (CHR, INT, DP, */
123 /*     or TIME).  The type is actually implied by the class, but it */
124 /*     will frequently be convenient to look up the type directly. */
125 
126 
127 
128 /*     LENIDX is the index of the column's string length value, if the */
129 /*     column has character type.  A value of IFALSE in this element of */
130 /*     the descriptor indicates that the strings have variable length. */
131 
132 
133 /*     SIZIDX is the index of the column's element size value.  This */
134 /*     descriptor element is meaningful for columns with fixed-size */
135 /*     entries.  For variable-sized columns, this value is IFALSE. */
136 
137 
138 /*     NAMIDX is the index of the base address of the column's name. */
139 
140 
141 /*     IXTIDX is the data type of the column's index.  IXTIDX */
142 /*     contains a type value only if the column is indexed. For columns */
143 /*     that are not indexed, the location IXTIDX contains the boolean */
144 /*     value IFALSE. */
145 
146 
147 /*     IXPIDX is a pointer to the column's index.  IXTPDX contains a */
148 /*     meaningful value only if the column is indexed.  The */
149 /*     interpretation of the pointer depends on the data type of the */
150 /*     index. */
151 
152 
153 /*     NFLIDX is the index of a flag indicating whether nulls are */
154 /*     permitted in the column.  The value at location NFLIDX is */
155 /*     ITRUE if nulls are permitted and IFALSE otherwise. */
156 
157 
158 /*     ORDIDX is the index of the column's ordinal position in the */
159 /*     list of columns belonging to the column's parent segment. */
160 
161 
162 /*     METIDX is the index of the column's integer metadata pointer. */
163 /*     This pointer is a DAS integer address. */
164 
165 
166 /*     The last position in the column descriptor is reserved.  No */
167 /*     parameter is defined to point to this location. */
168 
169 
170 /*     End Include Section:  EK Column Descriptor Parameters */
171 
172 /* $ Disclaimer */
173 
174 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
175 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
176 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
177 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
178 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
179 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
180 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
181 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
182 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
183 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
184 
185 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
186 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
187 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
188 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
189 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
190 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
191 
192 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
193 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
194 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
195 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
196 
197 
198 /*     Include Section:  EK Segment Descriptor Parameters */
199 
200 /*        eksegdsc.inc  Version 8  06-NOV-1995 (NJB) */
201 
202 
203 /*     All `base addresses' referred to below are the addresses */
204 /*     *preceding* the item the base applies to.  This convention */
205 /*     enables simplied address calculations in many cases. */
206 
207 /*     Size of segment descriptor.  Note:  the include file ekcoldsc.inc */
208 /*     must be updated if this parameter is changed.  The parameter */
209 /*     CDOFF in that file should be kept equal to SDSCSZ. */
210 
211 
212 /*     Index of the segment type code: */
213 
214 
215 /*     Index of the segment's number.  This number is the segment's */
216 /*     index in the list of segments contained in the EK to which */
217 /*     the segment belongs. */
218 
219 
220 /*     Index of the DAS integer base address of the segment's integer */
221 /*     meta-data: */
222 
223 
224 /*     Index of the DAS character base address of the table name: */
225 
226 
227 /*     Index of the segment's column count: */
228 
229 
230 /*     Index of the segment's record count: */
231 
232 
233 /*     Index of the root page number of the record tree: */
234 
235 
236 /*     Index of the root page number of the character data page tree: */
237 
238 
239 /*     Index of the root page number of the double precision data page */
240 /*     tree: */
241 
242 
243 /*     Index of the root page number of the integer data page tree: */
244 
245 
246 /*     Index of the `modified' flag: */
247 
248 
249 /*     Index of the `initialized' flag: */
250 
251 
252 /*     Index of the shadowing flag: */
253 
254 
255 /*     Index of the companion file handle: */
256 
257 
258 /*     Index of the companion segment number: */
259 
260 
261 /*     The next three items are, respectively, the page numbers of the */
262 /*     last character, d.p., and integer data pages allocated by the */
263 /*     segment: */
264 
265 
266 /*     The next three items are, respectively, the page-relative */
267 /*     indices of the last DAS word in use in the segment's */
268 /*     last character, d.p., and integer data pages: */
269 
270 
271 /*     Index of the DAS character base address of the column name list: */
272 
273 
274 /*     The last descriptor element is reserved for future use.  No */
275 /*     parameter is defined to point to this location. */
276 
277 
278 /*     End Include Section:  EK Segment Descriptor Parameters */
279 
280 /* $ Disclaimer */
281 
282 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
283 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
284 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
285 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
286 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
287 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
288 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
289 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
290 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
291 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
292 
293 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
294 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
295 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
296 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
297 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
298 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
299 
300 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
301 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
302 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
303 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
304 
305 
306 /*     Include Section:  EK Data Types */
307 
308 /*        ektype.inc Version 1  27-DEC-1994 (NJB) */
309 
310 
311 /*     Within the EK system, data types of EK column contents are */
312 /*     represented by integer codes.  The codes and their meanings */
313 /*     are listed below. */
314 
315 /*     Integer codes are also used within the DAS system to indicate */
316 /*     data types; the EK system makes no assumptions about compatibility */
317 /*     between the codes used here and those used in the DAS system. */
318 
319 
320 /*     Character type: */
321 
322 
323 /*     Double precision type: */
324 
325 
326 /*     Integer type: */
327 
328 
329 /*     `Time' type: */
330 
331 /*     Within the EK system, time values are represented as ephemeris */
332 /*     seconds past J2000 (TDB), and double precision numbers are used */
333 /*     to store these values.  However, since time values require special */
334 /*     treatment both on input and output, and since the `TIME' column */
335 /*     has a special role in the EK specification and code, time values */
336 /*     are identified as a type distinct from double precision numbers. */
337 
338 
339 /*     End Include Section:  EK Data Types */
340 
341 /* $ Brief_I/O */
342 
343 /*     Variable  I/O  Description */
344 /*     --------  ---  -------------------------------------------------- */
345 /*     HANDLE     I   EK file handle. */
346 /*     SEGNO      I   Index of segment containing record. */
347 /*     RECNO      I   Record to which data is to be added. */
348 /*     COLUMN     I   Column name. */
349 /*     NVALS      I   Number of values to add to column. */
350 /*     CVALS      I   Character values to add to column. */
351 /*     ISNULL     I   Flag indicating whether column entry is null. */
352 
353 /* $ Detailed_Input */
354 
355 /*     HANDLE         is the handle of an EK file open for write access. */
356 
357 /*     SEGNO          is the index of the segment to which data is to */
358 /*                    be added. */
359 
360 /*     RECNO          is the index of the record to which data is to be */
361 /*                    added.  This record number is relative to the start */
362 /*                    of the segment indicated by SEGNO; the first */
363 /*                    record in the segment has index 1. */
364 
365 /*     COLUMN         is the name of the column to which data is to be */
366 /*                    added. */
367 
368 /*     NVALS, */
369 /*     CVALS          are, respectively, the number of values to add to */
370 /*                    the specified column and the set of values */
371 /*                    themselves.  The data values are written into the */
372 /*                    specified column and record. */
373 
374 /*                    If the  column has fixed-size entries, then NVALS */
375 /*                    must equal the entry size for the specified column. */
376 
377 /*                    Only one value can be added to a virtual column. */
378 
379 
380 /*     ISNULL         is a logical flag indicating whether the entry is */
381 /*                    null.  If ISNULL is .FALSE., the column entry */
382 /*                    defined by NVALS and CVALS is added to the */
383 /*                    specified kernel file. */
384 
385 /*                    If ISNULL is .TRUE., NVALS and CVALS are ignored. */
386 /*                    The contents of the column entry are undefined. */
387 /*                    If the column has fixed-length, variable-size */
388 /*                    entries, the number of entries is considered to */
389 /*                    be 1. */
390 
391 /* $ Detailed_Output */
392 
393 /*     None.  See $Particulars for a description of the effect of this */
394 /*     routine. */
395 
396 /* $ Parameters */
397 
398 /*     None. */
399 
400 /* $ Exceptions */
401 
402 /*     1)  If HANDLE is invalid, the error will be diagnosed by routines */
403 /*         called by this routine. */
404 
405 /*     2)  If SEGNO is out of range, the error will be diagnosed by */
406 /*         routines called by this routine. */
407 
408 /*     3)  If COLUMN is not the name of a declared column, the error */
409 /*         will be diagnosed by routines called by this routine. */
410 
411 /*     4)  If COLUMN specifies a column of whose data type is not */
412 /*         character, the error SPICE(WRONGDATATYPE) will be */
413 /*         signaled. */
414 
415 /*     5)  If RECNO is out of range, the error will be diagnosed by */
416 /*         routines called by this routine. */
417 
418 /*     6)  If the specified column has fixed-size entries and NVALS */
419 /*         does not match this size, the error will be diagnosed by */
420 /*         routines called by this routine. */
421 
422 /*     7)  If the specified column has variable-size entries and NVALS */
423 /*         is non-positive, the error will be diagnosed by routines */
424 /*         called by this routine. */
425 
426 /*     8)  If an attempt is made to add a null value to a column that */
427 /*         doesn't take null values, the error will be diagnosed by */
428 /*         routines called by this routine. */
429 
430 /*     9)  If COLUMN specifies a column of whose class is not */
431 /*         an character class known to this routine, the error */
432 /*         SPICE(NOCLASS) will be signaled. */
433 
434 /*     10) If an I/O error occurs while reading or writing the indicated */
435 /*         file, the error will be diagnosed by routines called by this */
436 /*         routine. */
437 
438 /* $ Files */
439 
440 /*     See the EK Required Reading for a discussion of the EK file */
441 /*     format. */
442 
443 /* $ Particulars */
444 
445 /*     This routine operates by side effects:  it modifies the named */
446 /*     EK file by adding data to the specified record in the specified */
447 /*     column.  Data may be added to a segment in random order; it is not */
448 /*     necessary to fill in columns or rows sequentially.  Data may only */
449 /*     be added one column entry at a time. */
450 
451 /* $ Examples */
452 
453 /*     1)  Add the value '999' to the third record of the column CCOL in */
454 /*         the fifth segment of an EK file designated by HANDLE. */
455 
456 /*            CALL EKACEC ( HANDLE, 5, 3, 'CCOL', 1, '999', .FALSE. ) */
457 
458 
459 /*     2)  Same as (1), but this time add a null value.  The argument */
460 /*         999 is ignored because the null flag is set to .TRUE. */
461 
462 /*            CALL EKACEC ( HANDLE, 5, 3, 'CCOL', 1, '999', .TRUE. ) */
463 
464 
465 /*     3)  Add an array CBUFF of 10 values to the third record of the */
466 /*         column CARRAY in the fifth segment of an EK file designated by */
467 /*         HANDLE. */
468 
469 /*            CALL EKACEC ( HANDLE, 5, 3, 'CARRAY', 10, CBUFF, .FALSE. ) */
470 
471 
472 /*     4)  A more detailed example. */
473 
474 /*         Suppose we have an E-kernel named ORDER_DB.EK which contains */
475 /*         records of orders for data products.  The E-kernel has a */
476 /*         table called DATAORDERS that consists of the set of columns */
477 /*         listed below: */
478 
479 /*            DATAORDERS */
480 
481 /*               Column Name     Data Type */
482 /*               -----------     --------- */
483 /*               ORDER_ID        INTEGER */
484 /*               CUSTOMER_ID     INTEGER */
485 /*               LAST_NAME       CHARACTER*(*) */
486 /*               FIRST_NAME      CHARACTER*(*) */
487 /*               ORDER_DATE      TIME */
488 /*               COST            DOUBLE PRECISION */
489 
490 /*         The order database also has a table of items that have been */
491 /*         ordered.  The columns of this table are shown below: */
492 
493 /*            DATAITEMS */
494 
495 /*               Column Name     Data Type */
496 /*               -----------     --------- */
497 /*               ITEM_ID         INTEGER */
498 /*               ORDER_ID        INTEGER */
499 /*               ITEM_NAME       CHARACTER*(*) */
500 /*               DESCRIPTION     CHARACTER*(*) */
501 /*               PRICE           DOUBLE PRECISION */
502 
503 
504 /*         We'll suppose that the file ORDER_DB.EK contains two segments, */
505 /*         the first containing the DATAORDERS table and the second */
506 /*         containing the DATAITEMS table. */
507 
508 /*         If we wanted to insert a new record into the DATAORDERS */
509 /*         table in position 1, we'd make the following calls: */
510 
511 /*            C */
512 /*            C     Open the database for write access.  This call is */
513 /*            C     made when the file already exists.  See EKOPN for */
514 /*            C     an example of creating a new file. */
515 /*            C */
516 /*                  CALL EKOPW ( 'ORDER_DB.EK', HANDLE ) */
517 
518 /*            C */
519 /*            C     Append a new, empty record to the DATAORDERS */
520 /*            C     table. Recall that the DATAORDERS table */
521 /*            C     is in segment number 1.  The call will return */
522 /*            C     the number of the new, empty record. */
523 /*            C */
524 /*                  CALL EKAPPR ( HANDLE, 1, RECNO ) */
525 
526 /*            C */
527 /*            C     At this point, the new record is empty.  A valid EK */
528 /*            C     cannot contain empty records.  We fill in the data */
529 /*            C     here.  Data items are filled in one column at a time. */
530 /*            C     The order in which the columns are filled in is not */
531 /*            C     important.  We use the EKACEx (add column entry) */
532 /*            C     routines to fill in column entries.  We'll assume */
533 /*            C     that no entries are null.  All entries are scalar, */
534 /*            C     so the entry size is 1. */
535 /*            C */
536 /*                  ISNULL   =  .FALSE. */
537 /*                  ESIZE    =  1 */
538 
539 /*            C */
540 /*            C     The following variables will contain the data for */
541 /*            C     the new record. */
542 /*            C */
543 /*                  ORDID    =   10011 */
544 /*                  CUSTID   =   531 */
545 /*                  LNAME    =   'Scientist' */
546 /*                  FNAME    =   'Joe' */
547 /*                  ODATE    =   '1995-SEP-20' */
548 /*                  COST     =   0.D0 */
549 
550 /*            C */
551 /*            C     Note that the names of the routines called */
552 /*            C     correspond to the data types of the columns:  the */
553 /*            C     last letter of the routine name is C, I, or D, */
554 /*            C     depending on the data type.  Time values are */
555 /*            C     converted to ET for storage. */
556 /*            C */
557 /*                  CALL EKACEI ( HANDLE, SEGNO,  RECNO, 'ORDER_ID', */
558 /*                 .              SIZE,   ORDID,  ISNULL               ) */
559 
560 /*                  CALL EKACEI ( HANDLE, SEGNO,  RECNO, 'CUSTOMER_ID', */
561 /*                 .              SIZE,   CUSTID, ISNULL               ) */
562 
563 /*                  CALL EKACEC ( HANDLE, SEGNO,  RECNO, 'LAST_NAME', */
564 /*                 .              SIZE,   LNAME,  ISNULL               ) */
565 
566 /*                  CALL EKACEC ( HANDLE, SEGNO,  RECNO, 'FIRST_NAME', */
567 /*                 .              SIZE,   FNAME,  ISNULL               ) */
568 
569 
570 /*                  CALL UTC2ET ( ODATE,  ET ) */
571 /*                  CALL EKACED ( HANDLE, SEGNO,  RECNO, 'ORDER_DATE', */
572 /*                 .              SIZE,   ET,     ISNULL               ) */
573 
574 /*                  CALL EKACED ( HANDLE, SEGNO,  RECNO, 'COST', */
575 /*                 .              SIZE,   COST,   ISNULL               ) */
576 
577 /*            C */
578 /*            C     Close the file to make the update permanent. */
579 /*            C */
580 /*                  CALL EKCLS ( HANDLE ) */
581 
582 
583 /* $ Restrictions */
584 
585 /*     None. */
586 
587 /* $ Literature_References */
588 
589 /*     None. */
590 
591 /* $ Author_and_Institution */
592 
593 /*     N.J. Bachman   (JPL) */
594 
595 /* $ Version */
596 
597 /* -    SPICELIB Version 1.1.0, 05-FEB-2015 (NJB) */
598 
599 /*        Updated to use ERRHAN. */
600 
601 /* -    Beta Version 1.0.0, 26-SEP-1995 (NJB) */
602 
603 /* -& */
604 /* $ Index_Entries */
605 
606 /*     add character data to EK column */
607 /*     add data to EK */
608 /*     write character data to EK column */
609 
610 /* -& */
611 
612 /*     SPICELIB functions */
613 
614 
615 /*     Local variables */
616 
617 
618 /*     Use discovery check-in. */
619 
620 /*     First step:  find the descriptor for the named segment.  Using */
621 /*     this descriptor, get the column descriptor. */
622 
623     zzeksdsc_(handle, segno, segdsc);
624     zzekcdsc_(handle, segdsc, column, coldsc, column_len);
625     if (failed_()) {
626 	return 0;
627     }
628 
629 /*     This column had better be of character type. */
630 
631     dtype = coldsc[1];
632     if (dtype != 1) {
633 	chkin_("EKACEC", (ftnlen)6);
634 	setmsg_("Column # is of type #; EKACEC only works with character col"
635 		"umns.  RECNO = #; SEGNO = #; EK = #.", (ftnlen)95);
636 	errch_("#", column, (ftnlen)1, column_len);
637 	errint_("#", &dtype, (ftnlen)1);
638 	errint_("#", recno, (ftnlen)1);
639 	errint_("#", segno, (ftnlen)1);
640 	errhan_("#", handle, (ftnlen)1);
641 	sigerr_("SPICE(WRONGDATATYPE)", (ftnlen)20);
642 	chkout_("EKACEC", (ftnlen)6);
643 	return 0;
644     }
645 
646 /*     Look up the record pointer for the target record. */
647 
648     zzektrdp_(handle, &segdsc[6], recno, &recptr);
649 
650 /*     Now it's time to add data to the file. */
651 
652     class__ = coldsc[0];
653     if (class__ == 3) {
654 
655 /*        Class 3 columns contain scalar character data. */
656 
657 	zzekad03_(handle, segdsc, coldsc, &recptr, cvals, isnull, cvals_len);
658     } else if (class__ == 6) {
659 
660 /*        Class 6 columns contain array-valued character data. */
661 
662 	zzekad06_(handle, segdsc, coldsc, &recptr, nvals, cvals, isnull,
663 		cvals_len);
664     } else {
665 
666 /*        This is an unsupported character column class. */
667 
668 	chkin_("EKACEC", (ftnlen)6);
669 	setmsg_("Class # from input column descriptor is not a supported cha"
670 		"racter class.  COLUMN = #; RECNO = #; SEGNO = #; EK = #.", (
671 		ftnlen)115);
672 	errint_("#", &class__, (ftnlen)1);
673 	errch_("#", column, (ftnlen)1, column_len);
674 	errint_("#", recno, (ftnlen)1);
675 	errint_("#", segno, (ftnlen)1);
676 	errhan_("#", handle, (ftnlen)1);
677 	sigerr_("SPICE(NOCLASS)", (ftnlen)14);
678 	chkout_("EKACEC", (ftnlen)6);
679 	return 0;
680     }
681     return 0;
682 } /* ekacec_ */
683 
684