Mapper
finder.c
Go to the documentation of this file.
1 #include <sqlhdr.h>
2 #include <sqliapi.h>
3 static const char *_Cn6 = "senscursor";
4 static const char *_Cn5 = "qid2";
5 static const char *_Cn4 = "descursor";
6 static const char *_Cn3 = "qid1";
7 static const char *_Cn2 = "idcursor";
8 static const char *_Cn1 = "qid0";
9 #line 1 "finder.ec"
10 #include <stdio.h>
11 #include <math.h>
12 #include <string.h>
13 /*
14  * EXEC SQL include sqlca;
15  */
16 #line 4 "finder.ec"
17 
18 #line 4 "finder.ec"
19 #line 1 "/opt/informix/incl/esql/sqlca.h"
20 /***************************************************************************
21  *
22  * INFORMIX SOFTWARE, INC.
23  *
24  * PROPRIETARY DATA
25  *
26  * THIS DOCUMENT CONTAINS TRADE SECRET DATA WHICH IS THE PROPERTY OF
27  * INFORMIX SOFTWARE, INC. THIS DOCUMENT IS SUBMITTED TO RECIPIENT IN
28  * CONFIDENCE. INFORMATION CONTAINED HEREIN MAY NOT BE USED, COPIED OR
29  * DISCLOSED IN WHOLE OR IN PART EXCEPT AS PERMITTED BY WRITTEN AGREEMENT
30  * SIGNED BY AN OFFICER OF INFORMIX SOFTWARE, INC.
31  *
32  * THIS MATERIAL IS ALSO COPYRIGHTED AS AN UNPUBLISHED WORK UNDER
33  * SECTIONS 104 AND 408 OF TITLE 17 OF THE UNITED STATES CODE.
34  * UNAUTHORIZED USE, COPYING OR OTHER REPRODUCTION IS PROHIBITED BY LAW.
35  *
36  *
37  * Title: sqlca.h
38  * Sccsid: @(#)sqlca.h 9.4 1/18/93 11:09:48
39  * Description:
40  * SQL Control Area
41  *
42  ***************************************************************************
43  */
44 
45 #ifndef SQLCA_INCL
46 #define SQLCA_INCL
47 
48 #include "ifxtypes.h"
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 typedef struct sqlca_s
55  {
56  int4 sqlcode;
57  char sqlerrm[72]; /* error message parameters */
58  char sqlerrp[8];
59  int4 sqlerrd[6];
60  /* 0 - estimated number of rows returned */
61  /* 1 - serial value after insert or ISAM error code */
62  /* 2 - number of rows processed */
63  /* 3 - estimated cost */
64  /* 4 - offset of the error into the SQL statement */
65  /* 5 - rowid after insert */
66 #ifdef _FGL_
67  char sqlawarn[8];
68 #else
69  struct sqlcaw_s
70  {
71  char sqlwarn0; /* = W if any of sqlwarn[1-7] = W */
72  char sqlwarn1; /* = W if any truncation occurred or
73  database has transactions or
74  no privileges revoked */
75  char sqlwarn2; /* = W if a null value returned or
76  ANSI database */
77  char sqlwarn3; /* = W if no. in select list != no. in into list or
78  turbo backend or no privileges granted */
79  char sqlwarn4; /* = W if no where clause on prepared update, delete or
80  incompatible float format */
81  char sqlwarn5; /* = W if non-ANSI statement */
82  char sqlwarn6; /* = W if server is in data replication secondary mode */
83  char sqlwarn7; /* = W if database locale is different from proc_locale
84  */
85  } sqlwarn;
86 #endif
88 
89 /* NOTE: 4gl assumes that the sqlwarn structure can be defined as
90  * sqlawarn -- an 8 character string, because single-char
91  * variables are not recognized in 4gl.
92  *
93  * If this structure should change, the code generated by 4gl compiler
94  * must also change
95  */
96 
97 #ifdef VMS
98 noshare
99 #endif /* VMS */
100 
101 #define SQLNOTFOUND 100
102 
103 #ifndef IFX_THREAD
104 extern struct sqlca_s sqlca;
105 
106 extern int4 SQLCODE;
107 
108 extern char SQLSTATE[];
109 #else /* IFX_THREAD */
110 extern int4 * ifx_sqlcode();
111 extern struct sqlca_s * ifx_sqlca();
112 #define SQLCODE (*(ifx_sqlcode()))
113 #define SQLSTATE ((char *)(ifx_sqlstate()))
114 #define sqlca (*(ifx_sqlca()))
115 #endif /* IFX_THREAD */
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif /* SQLCA_INCL */
122 
123 #line 103 "/opt/informix/incl/esql/sqlca.h"
124 #line 5 "finder.ec"
125 #define STNRECSIZE 100
126 #define SENSRECSIZE 90
127 
128 extern char hpe1[2], hpe2[2], hdur[2], ht[2], hs[2], he[2], hp[2];
129 
130 finder(char *name, char *ch5, char *plat, char *state, int *sqlerrcode)
131 
132 {
133 char resp[60];
134 /*
135  * $char hresp[60];
136  */
137 #line 14 "finder.ec"
138 #line 14 "finder.ec"
139  char hresp[60];
140 /*
141  * $char stn[6];
142  */
143 #line 15 "finder.ec"
144 #line 15 "finder.ec"
145  char stn[6];
146 char wildcrd[2];
147 int id;
148 
149 
150 
151 int j, num, numstn;
152 double *valptr;
153 double value, value2;
154 char ans[3];
155 char ans8[9];
156 char qmiss[2];
157 int *pc;
158 /*
159  * $int zdate;
160  */
161 #line 28 "finder.ec"
162 #line 28 "finder.ec"
163 int zdate;
164 /*
165  * $char stnid[6];
166  */
167 #line 29 "finder.ec"
168 #line 29 "finder.ec"
169  char stnid[6];
170 /*
171  * $int hour;
172  */
173 #line 30 "finder.ec"
174 #line 30 "finder.ec"
175 int hour;
176 
177 /*
178  * $struct stn_rectype{
179  * char id[6];
180  * char plat[9];
181  * char aid[9];
182  * char aid2[9];
183  * char des[51];
184  * char det[41];
185  * char init[9];
186  * char lat[7];
187  * char lng[8];
188  * int elev;
189  * char stat[3];
190  * char huc[9];
191  * char cou[4];
192  * char zon[5];
193  * int post;
194  * char dbsource[4];
195  * };
196  */
197 #line 32 "finder.ec"
198 #line 32 "finder.ec"
199 struct stn_rectype
200  {
201  char id[6];
202  char plat[9];
203  char aid[9];
204  char aid2[9];
205  char des[51];
206  char det[41];
207  char init[9];
208  char lat[7];
209  char lng[8];
210  int elev;
211  char stat[3];
212  char huc[9];
213  char cou[4];
214  char zon[5];
215  int post;
216  char dbsource[4];
217  } ;
218 /*
219  * $struct stn_rectype stn_rec[STNRECSIZE];
220  */
221 #line 50 "finder.ec"
222 #line 50 "finder.ec"
223 struct stn_rectype stn_rec[STNRECSIZE];
224 
225 /*
226  * $struct sens_rectype {
227  * char id[6], pe1[2], pe2[2], dur[2], t[2], s[2], e[2], p[2];
228  * char type[2], des[51], det[41];
229  * int post;
230  * char new_report[2], active[2], ok[2], rfs[2];
231  * int obstime;
232  * char prod[10], prod2ary[10], obsag[7], obsloc[4], prov_avail[2];
233  * char final_avail[8], ownag[7], ownloc[4], maintag[7], maintloc[4];
234  * char init[9], dbsource[4];
235  * };
236  */
237 #line 52 "finder.ec"
238 #line 52 "finder.ec"
239 struct sens_rectype
240  {
241  char id[6], pe1[2], pe2[2], dur[2], t[2], s[2], e[2], p[2];
242  char type[2], des[51], det[41];
243  int post;
244  char new_report[2], active[2], ok[2], rfs[2];
245  int obstime;
246  char prod[10], prod2ary[10], obsag[7], obsloc[4], prov_avail[2];
247  char final_avail[8], ownag[7], ownloc[4], maintag[7], maintloc[4];
248  char init[9], dbsource[4];
249  } ;
250 /*
251  * $struct sens_rectype sens_rec[SENSRECSIZE];
252  */
253 #line 62 "finder.ec"
254 #line 62 "finder.ec"
255 struct sens_rectype sens_rec[SENSRECSIZE];
256 
257 /*
258  * $struct group_rectype {
259  * char id[6], des[50], stnid1[6], stnid2[6], stnid3[6], stnid4[6],
260  * stnid5[6], stnid6[6], stnid7[6], stnid8[6], stnid9[6], stnid10[6] ;
261  * char ped1[8], ped2[8], ped3[8], ped4[8], ped5[8], ped6[8], ped7[8],
262  * ped8[8], ped9[8], ped10[8];
263  * int hour1, hour2, hour3, hour4, hour5, hour6, hour7, hour8,
264  * hour9, hour10;
265  * };
266  */
267 #line 64 "finder.ec"
268 #line 64 "finder.ec"
269 struct group_rectype
270  {
271  char id[6], des[50], stnid1[6], stnid2[6], stnid3[6], stnid4[6], stnid5[6], stnid6[6], stnid7[6], stnid8[6], stnid9[6], stnid10[6];
272  char ped1[8], ped2[8], ped3[8], ped4[8], ped5[8], ped6[8], ped7[8], ped8[8], ped9[8], ped10[8];
273  int hour1, hour2, hour3, hour4, hour5, hour6, hour7, hour8, hour9, hour10;
274  } ;
275 /*
276  * $struct group_rectype group_rec[STNRECSIZE];
277  */
278 #line 72 "finder.ec"
279 #line 72 "finder.ec"
280 struct group_rectype group_rec[STNRECSIZE];
281 
282 
283 /*
284  * $database fastetc;
285  */
286 #line 75 "finder.ec"
287  {
288 #line 75 "finder.ec"
289  sqli_db_open("fastetc", 0);
290 #line 75 "finder.ec"
291  }
292 
293 /*
294  * $prepare qid0 from "select * from stn where id matches ?";
295  */
296 #line 77 "finder.ec"
297  {
298 #line 77 "finder.ec"
299 #line 77 "finder.ec"
300 #line 77 "finder.ec"
301  sqli_prep(ESQLINTVERSION, (char *) _Cn1, "select * from stn where id matches ?",(ifx_literal_t *) 0, (ifx_namelist_t *) 0, 2, 0,0 );
302 #line 77 "finder.ec"
303  }
304  if (sqlca.sqlcode != 0) printf("sqlcod prepare stn = %d \n",sqlca.sqlcode);
305 
306 /*
307  * $declare idcursor cursor for qid0;
308  */
309 #line 80 "finder.ec"
310  {
311 #line 80 "finder.ec"
312 #line 80 "finder.ec"
313  sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn2, 512), (char *) _Cn2, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn1, 513), 0, 0);
314 #line 80 "finder.ec"
315  }
316  if (sqlca.sqlcode != 0) printf("sqlcod declare idcursor= %d \n", sqlca.sqlcode);
317 
318 /*
319  * $prepare qid1 from "select * from stn where des matches ?";
320  */
321 #line 83 "finder.ec"
322  {
323 #line 83 "finder.ec"
324 #line 83 "finder.ec"
325 #line 83 "finder.ec"
326  sqli_prep(ESQLINTVERSION, (char *) _Cn3, "select * from stn where des matches ?",(ifx_literal_t *) 0, (ifx_namelist_t *) 0, 2, 0,0 );
327 #line 83 "finder.ec"
328  }
329  if (sqlca.sqlcode != 0) printf("sqlcod prepare stn = %d \n",sqlca.sqlcode);
330 
331 /*
332  * $declare descursor cursor for qid1;
333  */
334 #line 86 "finder.ec"
335  {
336 #line 86 "finder.ec"
337 #line 86 "finder.ec"
338  sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn4, 512), (char *) _Cn4, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn3, 513), 0, 0);
339 #line 86 "finder.ec"
340  }
341  if (sqlca.sqlcode != 0) printf("sqlcod declare descursor= %d \n", sqlca.sqlcode);
342 
343 /*
344  * $prepare qid2 from "select * from sens where id = ?";
345  */
346 #line 89 "finder.ec"
347  {
348 #line 89 "finder.ec"
349 #line 89 "finder.ec"
350 #line 89 "finder.ec"
351  sqli_prep(ESQLINTVERSION, (char *) _Cn5, "select * from sens where id = ?",(ifx_literal_t *) 0, (ifx_namelist_t *) 0, 2, 0,0 );
352 #line 89 "finder.ec"
353  }
354  if (sqlca.sqlcode != 0) printf("sqlcod prepare sens = %d \n",sqlca.sqlcode);
355 
356 /*
357  * $declare senscursor cursor for qid2;
358  */
359 #line 92 "finder.ec"
360  {
361 #line 92 "finder.ec"
362 #line 92 "finder.ec"
363  sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn6, 512), (char *) _Cn6, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn5, 513), 0, 0);
364 #line 92 "finder.ec"
365  }
366  if (sqlca.sqlcode != 0) printf("sqlcod declare senscursor= %d \n", sqlca.sqlcode);
367 
368 
369 for (;;)
370  {
371 GET_INPUT:
372  strcpy(hresp,"*");
373  strcpy(wildcrd,"*");
374 
375  printf(" <CR> for name or ENTER part or all of the 5 ch. id: ");
376  gets(resp);
377  if(toupper(resp[0]) == 'Q' && resp[1] == '\0') break;
378  strupper(resp);
379  id = 1;
380 
381  if(resp[0]=='\0')
382  {
383  printf("<CR> for id or ENTER part or all of the station name: ");
384  gets(resp);
385  strupper(resp);
386  id = 0;
387  if(resp[0]=='\0') goto GET_INPUT;
388  }
389 
390  if(strstr(resp,"*") == NULL)
391  {
392  strcat(hresp,resp);
393  strcat(hresp,wildcrd);
394  }
395  else
396  strcpy(hresp,resp);
397 
398  printf("searching using the token -> %s \n",hresp);
399 
400  if(id)
401  {
402 /*
403  * $open idcursor using $hresp;
404  */
405 #line 129 "finder.ec"
406  {
407 #line 129 "finder.ec"
408  static ifx_sqlvar_t _sqibind[] =
409  {
410  { 100, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
411 #line 129 "finder.ec"
412  };
413  static ifx_sqlda_t _SD0 = { 1, _sqibind, {0}, 1, 0 };
414 #line 129 "finder.ec"
415  _sqibind[0].sqldata = hresp;
416 #line 129 "finder.ec"
417  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn2, 768), &_SD0, (char *) 0, (struct value *) 0, 1, 0);
418 #line 129 "finder.ec"
419  }
420  if (sqlca.sqlcode != 0) printf("sqlcod open idcursor= %d \n", sqlca.sqlcode);
421  j=0;
422  for (;;)
423  {
424 /*
425  * $fetch idcursor into $stn_rec[j];
426  */
427 #line 134 "finder.ec"
428  {
429 #line 134 "finder.ec"
430  static ifx_sqlvar_t _sqobind[] =
431  {
432  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
433  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
434  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
435  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
436  { 100, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
437  { 100, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
438  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
439  { 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
440  { 100, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
441  { 102, sizeof((stn_rec[j]).elev), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
442  { 100, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
443  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
444  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
445  { 100, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
446  { 102, sizeof((stn_rec[j]).post), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
447  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
448 #line 134 "finder.ec"
449  };
450  static ifx_sqlda_t _SD0 = { 16, _sqobind, {0}, 16, 0 };
451  static _FetchSpec _FS1 = { 0, 1, 0 };
452 #line 134 "finder.ec"
453  _sqobind[0].sqldata = (stn_rec[j]).id;
454 #line 134 "finder.ec"
455  _sqobind[1].sqldata = (stn_rec[j]).plat;
456 #line 134 "finder.ec"
457  _sqobind[2].sqldata = (stn_rec[j]).aid;
458 #line 134 "finder.ec"
459  _sqobind[3].sqldata = (stn_rec[j]).aid2;
460 #line 134 "finder.ec"
461  _sqobind[4].sqldata = (stn_rec[j]).des;
462 #line 134 "finder.ec"
463  _sqobind[5].sqldata = (stn_rec[j]).det;
464 #line 134 "finder.ec"
465  _sqobind[6].sqldata = (stn_rec[j]).init;
466 #line 134 "finder.ec"
467  _sqobind[7].sqldata = (stn_rec[j]).lat;
468 #line 134 "finder.ec"
469  _sqobind[8].sqldata = (stn_rec[j]).lng;
470 #line 134 "finder.ec"
471  _sqobind[9].sqldata = (char *) &(stn_rec[j]).elev;
472 #line 134 "finder.ec"
473  _sqobind[10].sqldata = (stn_rec[j]).stat;
474 #line 134 "finder.ec"
475  _sqobind[11].sqldata = (stn_rec[j]).huc;
476 #line 134 "finder.ec"
477  _sqobind[12].sqldata = (stn_rec[j]).cou;
478 #line 134 "finder.ec"
479  _sqobind[13].sqldata = (stn_rec[j]).zon;
480 #line 134 "finder.ec"
481  _sqobind[14].sqldata = (char *) &(stn_rec[j]).post;
482 #line 134 "finder.ec"
483  _sqobind[15].sqldata = (stn_rec[j]).dbsource;
484 #line 134 "finder.ec"
485  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn2, 768), (ifx_sqlda_t *) 0, &_SD0, (char *) 0, &_FS1);
486 #line 134 "finder.ec"
487  }
488  if(sqlca.sqlcode != 0) break;
489  j++;
490  if(j>100)
491  {
492  printf("that produces lotsa stations... please narrow your query. <CR> to continue");
493  gets(resp);
494  }
495  printf(" (%2d) %s %s %s \n",j,stn_rec[j-1].id, stn_rec[j-1].des, stn_rec[j-1].aid);
496  }
497 /*
498  * $close idcursor;
499  */
500 #line 144 "finder.ec"
501  {
502 #line 144 "finder.ec"
503 #line 144 "finder.ec"
504  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn2, 768));
505 #line 144 "finder.ec"
506  }
507  }
508  else
509  {
510 /*
511  * $open descursor using $hresp;
512  */
513 #line 148 "finder.ec"
514  {
515 #line 148 "finder.ec"
516  static ifx_sqlvar_t _sqibind[] =
517  {
518  { 100, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
519 #line 148 "finder.ec"
520  };
521  static ifx_sqlda_t _SD0 = { 1, _sqibind, {0}, 1, 0 };
522 #line 148 "finder.ec"
523  _sqibind[0].sqldata = hresp;
524 #line 148 "finder.ec"
525  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn4, 768), &_SD0, (char *) 0, (struct value *) 0, 1, 0);
526 #line 148 "finder.ec"
527  }
528  if (sqlca.sqlcode != 0) printf("sqlcod open descursor= %d \n", sqlca.sqlcode);
529  j=0;
530  for (;;)
531  {
532 /*
533  * $fetch descursor into $stn_rec[j];
534  */
535 #line 153 "finder.ec"
536  {
537 #line 153 "finder.ec"
538  static ifx_sqlvar_t _sqobind[] =
539  {
540  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
541  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
542  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
543  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
544  { 100, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
545  { 100, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
546  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
547  { 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
548  { 100, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
549  { 102, sizeof((stn_rec[j]).elev), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
550  { 100, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
551  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
552  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
553  { 100, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
554  { 102, sizeof((stn_rec[j]).post), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
555  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
556 #line 153 "finder.ec"
557  };
558  static ifx_sqlda_t _SD0 = { 16, _sqobind, {0}, 16, 0 };
559  static _FetchSpec _FS1 = { 0, 1, 0 };
560 #line 153 "finder.ec"
561  _sqobind[0].sqldata = (stn_rec[j]).id;
562 #line 153 "finder.ec"
563  _sqobind[1].sqldata = (stn_rec[j]).plat;
564 #line 153 "finder.ec"
565  _sqobind[2].sqldata = (stn_rec[j]).aid;
566 #line 153 "finder.ec"
567  _sqobind[3].sqldata = (stn_rec[j]).aid2;
568 #line 153 "finder.ec"
569  _sqobind[4].sqldata = (stn_rec[j]).des;
570 #line 153 "finder.ec"
571  _sqobind[5].sqldata = (stn_rec[j]).det;
572 #line 153 "finder.ec"
573  _sqobind[6].sqldata = (stn_rec[j]).init;
574 #line 153 "finder.ec"
575  _sqobind[7].sqldata = (stn_rec[j]).lat;
576 #line 153 "finder.ec"
577  _sqobind[8].sqldata = (stn_rec[j]).lng;
578 #line 153 "finder.ec"
579  _sqobind[9].sqldata = (char *) &(stn_rec[j]).elev;
580 #line 153 "finder.ec"
581  _sqobind[10].sqldata = (stn_rec[j]).stat;
582 #line 153 "finder.ec"
583  _sqobind[11].sqldata = (stn_rec[j]).huc;
584 #line 153 "finder.ec"
585  _sqobind[12].sqldata = (stn_rec[j]).cou;
586 #line 153 "finder.ec"
587  _sqobind[13].sqldata = (stn_rec[j]).zon;
588 #line 153 "finder.ec"
589  _sqobind[14].sqldata = (char *) &(stn_rec[j]).post;
590 #line 153 "finder.ec"
591  _sqobind[15].sqldata = (stn_rec[j]).dbsource;
592 #line 153 "finder.ec"
593  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn4, 768), (ifx_sqlda_t *) 0, &_SD0, (char *) 0, &_FS1);
594 #line 153 "finder.ec"
595  }
596  if(sqlca.sqlcode != 0) break;
597  j++;
598  if(j>100)
599  {
600  printf("that produces lotsa stations... please narrow your query <CR> to continue ");
601  gets(resp);
602  goto GET_INPUT;
603  }
604  printf(" (%2d) %s %s %s \n",j,stn_rec[j-1].id, stn_rec[j-1].des, stn_rec[j-1].aid);
605  }
606 /*
607  * $close descursor;
608  */
609 #line 164 "finder.ec"
610  {
611 #line 164 "finder.ec"
612 #line 164 "finder.ec"
613  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn4, 768));
614 #line 164 "finder.ec"
615  }
616  }
617 
618  if (j > 1)
619  {
620  printf("\nENTER the station number: ");
621  gets(resp);
622  if(toupper(resp[0]) == 'Q') break;
623  numstn = atoi(resp);
624  numstn--;
625  }
626  else
627  {
628  puts("\n\n");
629  numstn = 0;
630  }
631 
632 
633  strcpy(stn,stn_rec[numstn].id);
634 /*
635  * $open senscursor using $stn;
636  */
637 #line 183 "finder.ec"
638  {
639 #line 183 "finder.ec"
640  static ifx_sqlvar_t _sqibind[] =
641  {
642  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
643 #line 183 "finder.ec"
644  };
645  static ifx_sqlda_t _SD0 = { 1, _sqibind, {0}, 1, 0 };
646 #line 183 "finder.ec"
647  _sqibind[0].sqldata = stn;
648 #line 183 "finder.ec"
649  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn6, 768), &_SD0, (char *) 0, (struct value *) 0, 1, 0);
650 #line 183 "finder.ec"
651  }
652  if (sqlca.sqlcode != 0) printf("sqlcod open senscursor= %d \n", sqlca.sqlcode);
653  j=0;
654  for (;;)
655  {
656 /*
657  * $fetch senscursor into $sens_rec[j];
658  */
659 #line 188 "finder.ec"
660  {
661 #line 188 "finder.ec"
662  static ifx_sqlvar_t _sqobind[] =
663  {
664  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
665  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
666  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
667  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
668  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
669  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
670  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
671  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
672  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
673  { 100, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
674  { 100, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
675  { 102, sizeof((sens_rec[j]).post), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
676  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
677  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
678  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
679  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
680  { 102, sizeof((sens_rec[j]).obstime), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
681  { 100, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
682  { 100, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
683  { 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
684  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
685  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
686  { 100, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
687  { 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
688  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
689  { 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
690  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
691  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
692  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
693 #line 188 "finder.ec"
694  };
695  static ifx_sqlda_t _SD0 = { 29, _sqobind, {0}, 29, 0 };
696  static _FetchSpec _FS1 = { 0, 1, 0 };
697 #line 188 "finder.ec"
698  _sqobind[0].sqldata = (sens_rec[j]).id;
699 #line 188 "finder.ec"
700  _sqobind[1].sqldata = (sens_rec[j]).pe1;
701 #line 188 "finder.ec"
702  _sqobind[2].sqldata = (sens_rec[j]).pe2;
703 #line 188 "finder.ec"
704  _sqobind[3].sqldata = (sens_rec[j]).dur;
705 #line 188 "finder.ec"
706  _sqobind[4].sqldata = (sens_rec[j]).t;
707 #line 188 "finder.ec"
708  _sqobind[5].sqldata = (sens_rec[j]).s;
709 #line 188 "finder.ec"
710  _sqobind[6].sqldata = (sens_rec[j]).e;
711 #line 188 "finder.ec"
712  _sqobind[7].sqldata = (sens_rec[j]).p;
713 #line 188 "finder.ec"
714  _sqobind[8].sqldata = (sens_rec[j]).type;
715 #line 188 "finder.ec"
716  _sqobind[9].sqldata = (sens_rec[j]).des;
717 #line 188 "finder.ec"
718  _sqobind[10].sqldata = (sens_rec[j]).det;
719 #line 188 "finder.ec"
720  _sqobind[11].sqldata = (char *) &(sens_rec[j]).post;
721 #line 188 "finder.ec"
722  _sqobind[12].sqldata = (sens_rec[j]).new_report;
723 #line 188 "finder.ec"
724  _sqobind[13].sqldata = (sens_rec[j]).active;
725 #line 188 "finder.ec"
726  _sqobind[14].sqldata = (sens_rec[j]).ok;
727 #line 188 "finder.ec"
728  _sqobind[15].sqldata = (sens_rec[j]).rfs;
729 #line 188 "finder.ec"
730  _sqobind[16].sqldata = (char *) &(sens_rec[j]).obstime;
731 #line 188 "finder.ec"
732  _sqobind[17].sqldata = (sens_rec[j]).prod;
733 #line 188 "finder.ec"
734  _sqobind[18].sqldata = (sens_rec[j]).prod2ary;
735 #line 188 "finder.ec"
736  _sqobind[19].sqldata = (sens_rec[j]).obsag;
737 #line 188 "finder.ec"
738  _sqobind[20].sqldata = (sens_rec[j]).obsloc;
739 #line 188 "finder.ec"
740  _sqobind[21].sqldata = (sens_rec[j]).prov_avail;
741 #line 188 "finder.ec"
742  _sqobind[22].sqldata = (sens_rec[j]).final_avail;
743 #line 188 "finder.ec"
744  _sqobind[23].sqldata = (sens_rec[j]).ownag;
745 #line 188 "finder.ec"
746  _sqobind[24].sqldata = (sens_rec[j]).ownloc;
747 #line 188 "finder.ec"
748  _sqobind[25].sqldata = (sens_rec[j]).maintag;
749 #line 188 "finder.ec"
750  _sqobind[26].sqldata = (sens_rec[j]).maintloc;
751 #line 188 "finder.ec"
752  _sqobind[27].sqldata = (sens_rec[j]).init;
753 #line 188 "finder.ec"
754  _sqobind[28].sqldata = (sens_rec[j]).dbsource;
755 #line 188 "finder.ec"
756  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn6, 768), (ifx_sqlda_t *) 0, &_SD0, (char *) 0, &_FS1);
757 #line 188 "finder.ec"
758  }
759  if(sqlca.sqlcode != 0) break;
760  j++;
761  printf(" (%2d) %s %s%s%s%s%s%s%s \n", j, sens_rec[j-1].id, sens_rec[j-1].pe1,
762  sens_rec[j-1].pe2, sens_rec[j-1].dur, sens_rec[j-1].t, sens_rec[j-1].s,
763  sens_rec[j-1].e, sens_rec[j-1].p);
764  }
765 /*
766  * $close senscursor;
767  */
768 #line 195 "finder.ec"
769  {
770 #line 195 "finder.ec"
771 #line 195 "finder.ec"
772  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, (char *) _Cn6, 768));
773 #line 195 "finder.ec"
774  }
775 
776  if(j > 1)
777  {
778  printf("\nENTER the station/sensor number: ");
779  gets(resp);
780  if(toupper(resp[0]) == 'Q') break;
781  num = atoi(resp);
782  num--;
783  }
784  else
785  num = 0;
786 
787 
788 
789  printf("You chose (%d) %s %s%s%s%s%s%s%s \n", num+1, sens_rec[num].id, sens_rec[num].pe1,
790  sens_rec[num].pe2, sens_rec[num].dur, sens_rec[num].t, sens_rec[num].s,
791  sens_rec[num].e, sens_rec[num].p);
792 
793  strcpy(name,stn_rec[numstn].des);
794  ch5[0] = sens_rec[num].id[0];
795  ch5[1] = sens_rec[num].id[1];
796  ch5[2] = sens_rec[num].id[2];
797  ch5[3] = sens_rec[num].id[3];
798  ch5[4] = sens_rec[num].id[4];
799  ch5[5] = sens_rec[num].id[5];
800  strcpy(plat,stn_rec[numstn].plat);
801  strcpy(state,stn_rec[numstn].stat);
802  strcpy(hpe1,sens_rec[num].pe1);
803  strcpy(hpe2,sens_rec[num].pe2);
804  strcpy(hdur,sens_rec[num].dur);
805  strcpy(ht,sens_rec[num].t);
806  strcpy(hs,sens_rec[num].s);
807  strcpy(he,sens_rec[num].e);
808  strcpy(hp,sens_rec[num].p);
809  *sqlerrcode = SQLCODE;
810 /* printf("ped in finder = %s%s%s%s%s%s%s \n",hpe1,hpe2,hdur,ht,hs,he,hp);
811 */
812  return;
813 
814  }
815 }
816 
817 
818 
819 strupper(char *thestr)
820 
821 {
822 char *temps;
823 int i;
824 
825  for (i=0;i<60;i++)
826  {
827  if(thestr[i] != '\0')
828  thestr[i] = toupper(thestr[i]);
829  else
830  break;
831  }
832 }
833 
834 
835 
836 
837 
838 
839 
840 
841 
842 
843 
844 
845 
846 
847 
848 
849 
850 
851 
852 #line 271 "finder.ec"
char name[35][30]
Definition: borshef.c:10
static int i
int hour
Definition: display_data.c:26
static const char * _Cn3
Definition: finder.c:6
static const char * _Cn4
Definition: finder.c:5
char he[2]
Definition: finder.c:128
static const char * _Cn5
Definition: finder.c:4
static const char * _Cn1
Definition: finder.c:8
char hpe1[2]
static const char * _Cn6
Definition: finder.c:3
finder(char *name, char *ch5, char *plat, char *state, int *sqlerrcode)
Definition: finder.c:130
char hpe2[2]
Definition: finder.c:128
char ht[2]
Definition: finder.c:128
static const char * _Cn2
Definition: finder.c:7
strupper(char *thestr)
Definition: finder.c:819
#define STNRECSIZE
Definition: finder.c:125
int4 SQLCODE
struct sqlca_s ifx_sqlca_t
char SQLSTATE[]
struct sqlca_s sqlca
char hdur[2]
Definition: finder.c:128
char hs[2]
Definition: finder.c:128
#define SENSRECSIZE
Definition: finder.c:126
char hp[2]
Definition: finder.c:128
int rfs(int)
printf("fbuf is %s\n", fbuf)
int j
Definition: mapp2h.h:48
int elev
Definition: mapp2h.h:48
double lat
Definition: mapp2h.h:41
float value
Definition: misc.h:155
char id[6]
Definition: misc.h:157
char sqlwarn5
Definition: db.c:65
char sqlwarn3
Definition: db.c:61
char sqlwarn4
Definition: db.c:63
char sqlwarn7
Definition: db.c:67
char sqlwarn1
Definition: db.c:57
char sqlwarn6
Definition: db.c:66
char sqlwarn2
Definition: db.c:59
char sqlwarn0
Definition: db.c:56
Definition: db.c:43
int4 sqlcode
Definition: finder.c:56
long sqlerrd[6]
Definition: db.c:47
struct sqlca_s::sqlcaw_s sqlwarn
long sqlcode
Definition: db.c:44
char sqlerrm[72]
Definition: db.c:45
char sqlerrp[8]
Definition: db.c:46
Definition: misc.h:135
Definition: misc.h:264