Daily_QC
can.c
Go to the documentation of this file.
1 #include <sqlhdr.h>
2 extern _SQCURSOR *_iqnprep();
3 
4 #if !defined(__STDC__)
5 #define const
6 #endif
7 
8 static const char *_Cn1 = "stncursor";
9 #line 1 "can.ec"
10 #include "prototypes.h"
11 /*
12  * EXEC SQL include sqlca.h;
13  */
14 #line 2 "can.ec"
15 #line 2 "can.ec"
16 #line 1 "/opt/informix/incl/esql/sqlca.h"
17 /***************************************************************************
18  *
19  * INFORMIX SOFTWARE, INC.
20  *
21  * PROPRIETARY DATA
22  *
23  * THIS DOCUMENT CONTAINS TRADE SECRET DATA WHICH IS THE PROPERTY OF
24  * INFORMIX SOFTWARE, INC. THIS DOCUMENT IS SUBMITTED TO RECIPIENT IN
25  * CONFIDENCE. INFORMATION CONTAINED HEREIN MAY NOT BE USED, COPIED OR
26  * DISCLOSED IN WHOLE OR IN PART EXCEPT AS PERMITTED BY WRITTEN AGREEMENT
27  * SIGNED BY AN OFFICER OF INFORMIX SOFTWARE, INC.
28  *
29  * THIS MATERIAL IS ALSO COPYRIGHTED AS AN UNPUBLISHED WORK UNDER
30  * SECTIONS 104 AND 408 OF TITLE 17 OF THE UNITED STATES CODE.
31  * UNAUTHORIZED USE, COPYING OR OTHER REPRODUCTION IS PROHIBITED BY LAW.
32  *
33  *
34  * Title: sqlca.h
35  * Sccsid: @(#)sqlca.h 9.4 1/18/93 11:09:48
36  * Description:
37  * SQL Control Area
38  *
39  ***************************************************************************
40  */
41 
42 #ifndef SQLCA_INCL
43 
44 #define SQLCA_INCL
45 
46 struct sqlca_s
47  {
48  long sqlcode;
49  char sqlerrm[72]; /* error message parameters */
50  char sqlerrp[8];
51  long sqlerrd[6];
52  /* 0 - estimated number of rows returned */
53  /* 1 - serial value after insert or ISAM error code */
54  /* 2 - number of rows processed */
55  /* 3 - estimated cost */
56  /* 4 - offset of the error into the SQL statement */
57  /* 5 - rowid after insert */
58 #ifdef _FGL_
59  char sqlawarn[8];
60 #else
61  struct sqlcaw_s
62  {
63  char sqlwarn0; /* = W if any of sqlwarn[1-7] = W */
64  char sqlwarn1; /* = W if any truncation occurred or
65  database has transactions or
66  no privileges revoked */
67  char sqlwarn2; /* = W if a null value returned or
68  ANSI database */
69  char sqlwarn3; /* = W if no. in select list != no. in into list or
70  turbo backend or no privileges granted */
71  char sqlwarn4; /* = W if no where clause on prepared update, delete or
72  incompatible float format */
73  char sqlwarn5; /* = W if non-ANSI statement */
74  char sqlwarn6; /* = W if server is in data replication secondary mode */
75  char sqlwarn7; /* = W if database locale is different from proc_locale
76  */
77  } sqlwarn;
78 #endif
79  };
80 
81 /* NOTE: 4gl assumes that the sqlwarn structure can be defined as
82  * sqlawarn -- an 8 character string, because single-char
83  * variables are not recognized in 4gl.
84  *
85  * If this structure should change, the code generated by 4gl compiler
86  * must also change
87  */
88 
89 #ifdef VMS
90 noshare
91 #endif /* VMS */
92 
93 #ifndef IFX_THREAD
94 extern struct sqlca_s sqlca;
95 
96 extern long SQLCODE;
97 
98 extern char SQLSTATE[];
99 #else /* IFX_THREAD */
100 
101 #ifndef __cplusplus
102 extern long * ifx_sqlcode();
103 extern struct sqlca_s * ifx_sqlca();
104 #endif
105 
106 #define SQLCODE (*(ifx_sqlcode()))
107 #define SQLSTATE ((char *)(ifx_sqlstate()))
108 #define sqlca (*(ifx_sqlca()))
109 #endif /* IFX_THREAD */
110 
111 #define SQLNOTFOUND 100
112 
113 #endif /* SQLCA_INCL */
114 #line 97 "/opt/informix/incl/esql/sqlca.h"
115 #line 3 "can.ec"
116 
117 /*
118  * EXEC SQL BEGIN DECLARE SECTION;
119  */
120 #line 4 "can.ec"
121 
122 #line 5 "can.ec"
123 char t, s, pe1, pe2, dur;
124 struct etn_rec
125  {
126  char id[6];
127  char plat[9];
128  char des[51];
129  char det[41];
130  char init[9];
131  char lat[7];
132  char lng[8];
133  int elev;
134  char stat[3];
135  char huc[9];
136  char cou[4];
137  char zon[5];
138  char hsa[4];
139  char cwa[4];
140  int post;
141  char dbsource[4];
143 struct gage_info
144  {
145  char id[6];
146  char pe1[2];
147  char pe2[2];
148  char dur[2];
149  char t[2];
150  char s[2];
151  char e[2];
152  char p[2];
153  char mode[2];
154  } info;
156  {
157  char id[6];
158  char pe1[2];
159  char pe2[2];
160  char dur[2];
161  char t[2];
162  char s[2];
163  char e[2];
164  char p[2];
165  int cal_yr;
166  int mon;
167  int zday;
168  double zhr00;
169  double zhr01;
170  double zhr02;
171  double zhr03;
172  double zhr04;
173  double zhr05;
174  double zhr06;
175  double zhr07;
176  double zhr08;
177  double zhr09;
178  double zhr10;
179  double zhr11;
180  double zhr12;
181  double zhr13;
182  double zhr14;
183  double zhr15;
184  double zhr16;
185  double zhr17;
186  double zhr18;
187  double zhr19;
188  double zhr20;
189  double zhr21;
190  double zhr22;
191  double zhr23;
192  char qzhr00[2];
193  char qzhr01[2];
194  char qzhr02[2];
195  char qzhr03[2];
196  char qzhr04[2];
197  char qzhr05[2];
198  char qzhr06[2];
199  char qzhr07[2];
200  char qzhr08[2];
201  char qzhr09[2];
202  char qzhr10[2];
203  char qzhr11[2];
204  char qzhr12[2];
205  char qzhr13[2];
206  char qzhr14[2];
207  char qzhr15[2];
208  char qzhr16[2];
209  char qzhr17[2];
210  char qzhr18[2];
211  char qzhr19[2];
212  char qzhr20[2];
213  char qzhr21[2];
214  char qzhr22[2];
215  char qzhr23[2];
218  {
219  char id[6];
220  char pe1[2];
221  char pe2[2];
222  char dur[2];
223  char t[2];
224  char s[2];
225  char e[2];
226  char p[2];
227  int cal_yr;
228  int mon;
229  double zday01;
230  double zday02;
231  double zday03;
232  double zday04;
233  double zday05;
234  double zday06;
235  double zday07;
236  double zday08;
237  double zday09;
238  double zday10;
239  double zday11;
240  double zday12;
241  double zday13;
242  double zday14;
243  double zday15;
244  double zday16;
245  double zday17;
246  double zday18;
247  double zday19;
248  double zday20;
249  double zday21;
250  double zday22;
251  double zday23;
252  double zday24;
253  double zday25;
254  double zday26;
255  double zday27;
256  double zday28;
257  double zday29;
258  double zday30;
259  double zday31;
260  char qzday01[2];
261  char qzday02[2];
262  char qzday03[2];
263  char qzday04[2];
264  char qzday05[2];
265  char qzday06[2];
266  char qzday07[2];
267  char qzday08[2];
268  char qzday09[2];
269  char qzday10[2];
270  char qzday11[2];
271  char qzday12[2];
272  char qzday13[2];
273  char qzday14[2];
274  char qzday15[2];
275  char qzday16[2];
276  char qzday17[2];
277  char qzday18[2];
278  char qzday19[2];
279  char qzday20[2];
280  char qzday21[2];
281  char qzday22[2];
282  char qzday23[2];
283  char qzday24[2];
284  char qzday25[2];
285  char qzday26[2];
286  char qzday27[2];
287  char qzday28[2];
288  char qzday29[2];
289  char qzday30[2];
290  char qzday31[2];
292 struct eens_rec
293  {
294  char id[6];
295  char pe1[2];
296  char pe2[2];
297  char dur[2];
298  char t[2];
299  char s[2];
300  char e[2];
301  char p[2];
302  char type[2];
303  char des[51];
304  char det[41];
305  int post;
306  char new_report[2];
307  char active[2];
308  char rfs[2];
309  int obstime;
310  char prod[10];
311  char prod2ary[10];
312  char obsag[7];
313  char obsloc[4];
314  char prov_avail[2];
315  char final_avail[8];
316  char ownag[7];
317  char ownloc[4];
318  char maintag[7];
319  char maintloc[4];
320  char init[9];
321  char dbsource[4];
323 /*
324  * EXEC SQL END DECLARE SECTION;
325  */
326 #line 216 "can.ec"
327 
328 
329 struct data_rec {
330  char id[9];
331  char source[9];
332  char pe1;
333  char pe2;
334  char dur;
335  char t;
336  char s;
337  char e;
338  char p;
339  int zdate;
340  int ztime;
341  int czdate;
342  int cztime;
343  int idur;
344  double codp;
345  char lwal;
346  int idote;
347  int irev;
348  double value;
349  double values[96];
350  char lwals[96];
351  char pedtsep[8];
353 int mday[]={31,28,31,30,31,30,31,31,30,31,30,31} ;
354 void main(int argc, char **argv)
355 
356 {
357 struct stn_values *dtn_values;
358 struct stn_values *qtn_values;
359 time_t tim,tim1;
360 struct tm *gmtim;
361 struct tm *ltim;
362 int i,j,h;
363 struct stim btim;
364 struct stim etim;
365 struct stim btim1;
366 struct stim etim1;
367 struct stim etim2;
368 char oldstat[10];
369 char *s[5];
370 FILE *fp;
371 char pc[10];
372 char qual[10];
373 int k;
374 char mbuf[100];
375 char dbuf[80],ts1[80];
376 char ozon[20];
377 char zbuf[1000],abuf[100];
378 char name[60];
379 int zdate[10],ztime[10];
380 int bflag;
381 char *add,file[50],*key;
382 int maxdays;
383 time_t itime[20];
384 int qtotal,dtotal;
385 extern int optind,opterr,optopt;
386 extern char *optarg;
387 int c;
388 char *p,*q;
389 int month,day,year,hour,idflag;
390 char *directory,fname[50];
391 int fflag;
392 time_t tim2;
393 int qual_flag;
394 char qbuf[10];
395 double flng,flat;
396 int itemp,itemp1,itemp2,ival,len;
397 int l,ii;
398 int tip;
399 
400 t='1';
401 fp=fopen("junkfile","w");
402 
403 qbuf[1]=0;
404 
405 strcpy(qual,"SF");
406 qual_flag=0;
407 maxdays=100;
408 
409 while((c=getopt(argc,argv,"d:h:n:f:q:v"))!=-1){
410 
411  switch(c) {
412 
413  case 'f':
414 
415  strcpy(fname,optarg);
416  fflag=1;
417  break;
418 
419 
420  default:
421 
422  exit(1);
423 
424  }
425 
426  }
427 
429 
430 dtn_values=calloc(1000,sizeof(struct stn_values));
431 qtn_values=calloc(1000,sizeof(struct stn_values));
432 
433 
434 tim=time(NULL);
435 gmtim=gmtime(&tim);
436 btim.year=gmtim->tm_year+1900;
437 btim.month=gmtim->tm_mon+1;
438 btim.day=gmtim->tm_mday;
439 btim.hour=gmtim->tm_hour;
440 btim.minute=0;
441 
442 tim1=tim-(maxdays-1)*86400L;
443 gmtim=gmtime(&tim1);
444 
445 etim.year=gmtim->tm_year+1900;
446 etim.month=gmtim->tm_mon+1;
447 etim.day=gmtim->tm_mday;
448 etim.hour=12;
449 etim.minute=0;
450 
451 tim1=tim-maxdays*86400L;
452 gmtim=gmtime(&tim1);
453 
454 etim2.year=gmtim->tm_year+1900;
455 etim2.month=gmtim->tm_mon+1;
456 etim2.day=gmtim->tm_mday;
457 etim2.hour=12;
458 etim2.minute=0;
459 
460 /*
461  * EXEC SQL open stncursor;
462  */
463 #line 349 "can.ec"
464  {
465 #line 349 "can.ec"
466 #line 349 "can.ec"
467  _iqdcopen(_iqlocate_cursor((char *) _Cn1, 100), (struct sqlda *) 0, (char *) 0, (struct value *) 0, 0, 0);
468 #line 349 "can.ec"
469  }
470 
471 if(sqlca.sqlcode < 0){
472 
473  printf("informix error %d\n",sqlca.sqlcode);
474  exit(1);
475 
476  }
477 
478 for(i=0;i<5000;i++) {
479 
480  mbuf[0]=0;
481 
482  bflag=0;
483 /*
484  * EXEC SQL fetch stncursor into :btn_rec;
485  */
486 #line 363 "can.ec"
487  {
488 #line 363 "can.ec"
489  static struct sqlvar_struct _sqobind[] =
490  {
491  { 100, 6, 0, 0, 0, 0, 0, 0, 0 },
492  { 100, 9, 0, 0, 0, 0, 0, 0, 0 },
493  { 100, 51, 0, 0, 0, 0, 0, 0, 0 },
494  { 100, 41, 0, 0, 0, 0, 0, 0, 0 },
495  { 100, 9, 0, 0, 0, 0, 0, 0, 0 },
496  { 100, 7, 0, 0, 0, 0, 0, 0, 0 },
497  { 100, 8, 0, 0, 0, 0, 0, 0, 0 },
498  { 102, sizeof((btn_rec).elev), 0, 0, 0, 0, 0, 0, 0 },
499  { 100, 3, 0, 0, 0, 0, 0, 0, 0 },
500  { 100, 9, 0, 0, 0, 0, 0, 0, 0 },
501  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
502  { 100, 5, 0, 0, 0, 0, 0, 0, 0 },
503  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
504  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
505  { 102, sizeof((btn_rec).post), 0, 0, 0, 0, 0, 0, 0 },
506  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
507 #line 363 "can.ec"
508  };
509  static struct sqlda _SD0 = { 16, _sqobind, {0}, 16, 0 };
510  static _FetchSpec _FS1 = { 0, 1, 0 };
511 #line 363 "can.ec"
512  _sqobind[0].sqldata = (btn_rec).id;
513 #line 363 "can.ec"
514  _sqobind[1].sqldata = (btn_rec).plat;
515 #line 363 "can.ec"
516  _sqobind[2].sqldata = (btn_rec).des;
517 #line 363 "can.ec"
518  _sqobind[3].sqldata = (btn_rec).det;
519 #line 363 "can.ec"
520  _sqobind[4].sqldata = (btn_rec).init;
521 #line 363 "can.ec"
522  _sqobind[5].sqldata = (btn_rec).lat;
523 #line 363 "can.ec"
524  _sqobind[6].sqldata = (btn_rec).lng;
525 #line 363 "can.ec"
526  _sqobind[7].sqldata = (char *) &(btn_rec).elev;
527 #line 363 "can.ec"
528  _sqobind[8].sqldata = (btn_rec).stat;
529 #line 363 "can.ec"
530  _sqobind[9].sqldata = (btn_rec).huc;
531 #line 363 "can.ec"
532  _sqobind[10].sqldata = (btn_rec).cou;
533 #line 363 "can.ec"
534  _sqobind[11].sqldata = (btn_rec).zon;
535 #line 363 "can.ec"
536  _sqobind[12].sqldata = (btn_rec).hsa;
537 #line 363 "can.ec"
538  _sqobind[13].sqldata = (btn_rec).cwa;
539 #line 363 "can.ec"
540  _sqobind[14].sqldata = (char *) &(btn_rec).post;
541 #line 363 "can.ec"
542  _sqobind[15].sqldata = (btn_rec).dbsource;
543 #line 363 "can.ec"
544  _iqcftch(_iqlocate_cursor((char *) _Cn1, 100), (struct sqlda *) 0, &_SD0, (char *) 0, &_FS1);
545 #line 363 "can.ec"
546  }
547 
548  if(sqlca.sqlcode < 0){
549 
550  printf("informix error %d\n",sqlca.sqlcode);
551  exit(1);
552 
553  }
554 
555  if(sqlca.sqlcode != 0)
556  break;
557 /*
558  for(l=0;l<5;l++) {
559 
560  if(l==0) {
561 
562  EXEC SQL select *
563  into :bens_rec
564  from sens
565  where id=:btn_rec.id and
566  pe1='P' and
567  pe2='P' and
568  dur='D' and
569  t=:t and
570  s='P' and
571  e='Z' and
572  p='Z';
573 
574  }
575 
576 
577  else if(l==1) {
578 
579  EXEC SQL select *
580  into :bens_rec
581  from sens
582  where id=:btn_rec.id and
583  pe1='P' and
584  pe2='P' and
585  dur='D' and
586  t=:t and
587  s='G' and
588  e='Z' and
589  p='Z';
590 
591  }
592 
593 
594  else if(l==2) {
595 
596  EXEC SQL select *
597  into :bens_rec
598  from sens
599  where id=:btn_rec.id and
600  pe1='P' and
601  pe2='P' and
602  dur='D' and
603  t=:t and
604  s='M' and
605  e='Z' and
606  p='Z';
607 
608  }
609 
610  else if(l==3) {
611 
612  EXEC SQL select *
613  into :bens_rec
614  from sens
615  where id=:btn_rec.id and
616  pe1='P' and
617  pe2='P' and
618  dur='D' and
619  t=:t and
620  s='Z' and
621  e='Z' and
622  p='Z';
623 
624  }
625 
626  else if(l==4) {
627 
628  EXEC SQL select *
629  into :bens_rec
630  from sens
631  where id=:btn_rec.id and
632  pe1='P' and
633  pe2='P' and
634  dur='D' and
635  t=:t and
636  s='R' and
637  e='Z' and
638  p='Z';
639 
640  } */
641 
642 
643 /*
644  * EXEC SQL select *
645  * into :bens_rec
646  * from sens
647  * where id=:btn_rec.id and
648  * pe1='P' and
649  * pe2='P' and
650  * dur='D' and
651  * t=:t and
652  * s='R' and
653  * e='Z' and
654  * p='Z';
655  */
656 #line 460 "can.ec"
657  {
658 #line 460 "can.ec"
659  static const char *sqlcmdtxt[] =
660 #line 460 "can.ec"
661  {
662 #line 460 "can.ec"
663  " select * from sens where id = ? and pe1 = 'P' and pe2 = 'P' and dur = 'D' and t = ? and s = 'R' and e = 'Z' and p = 'Z'",
664  0
665  };
666 #line 470 "can.ec"
667  static _SQCURSOR _SQ0 = {0};
668  static struct sqlvar_struct _sqibind[] =
669  {
670  { 100, 6, 0, 0, 0, 0, 0, 0, 0 },
671  { 108, 1, 0, 0, 0, 0, 0, 0, 0 },
672 #line 470 "can.ec"
673  };
674  static struct sqlvar_struct _sqobind[] =
675  {
676  { 100, 6, 0, 0, 0, 0, 0, 0, 0 },
677  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
678  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
679  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
680  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
681  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
682  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
683  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
684  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
685  { 100, 51, 0, 0, 0, 0, 0, 0, 0 },
686  { 100, 41, 0, 0, 0, 0, 0, 0, 0 },
687  { 102, sizeof((bens_rec).post), 0, 0, 0, 0, 0, 0, 0 },
688  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
689  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
690  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
691  { 102, sizeof((bens_rec).obstime), 0, 0, 0, 0, 0, 0, 0 },
692  { 100, 10, 0, 0, 0, 0, 0, 0, 0 },
693  { 100, 10, 0, 0, 0, 0, 0, 0, 0 },
694  { 100, 7, 0, 0, 0, 0, 0, 0, 0 },
695  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
696  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
697  { 100, 8, 0, 0, 0, 0, 0, 0, 0 },
698  { 100, 7, 0, 0, 0, 0, 0, 0, 0 },
699  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
700  { 100, 7, 0, 0, 0, 0, 0, 0, 0 },
701  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
702  { 100, 9, 0, 0, 0, 0, 0, 0, 0 },
703  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
704 #line 470 "can.ec"
705  };
706 #line 470 "can.ec"
707  _sqibind[0].sqldata = btn_rec.id;
708 #line 470 "can.ec"
709  _sqibind[1].sqldata = &t;
710 #line 470 "can.ec"
711  _sqobind[0].sqldata = (bens_rec).id;
712 #line 470 "can.ec"
713  _sqobind[1].sqldata = (bens_rec).pe1;
714 #line 470 "can.ec"
715  _sqobind[2].sqldata = (bens_rec).pe2;
716 #line 470 "can.ec"
717  _sqobind[3].sqldata = (bens_rec).dur;
718 #line 470 "can.ec"
719  _sqobind[4].sqldata = (bens_rec).t;
720 #line 470 "can.ec"
721  _sqobind[5].sqldata = (bens_rec).s;
722 #line 470 "can.ec"
723  _sqobind[6].sqldata = (bens_rec).e;
724 #line 470 "can.ec"
725  _sqobind[7].sqldata = (bens_rec).p;
726 #line 470 "can.ec"
727  _sqobind[8].sqldata = (bens_rec).type;
728 #line 470 "can.ec"
729  _sqobind[9].sqldata = (bens_rec).des;
730 #line 470 "can.ec"
731  _sqobind[10].sqldata = (bens_rec).det;
732 #line 470 "can.ec"
733  _sqobind[11].sqldata = (char *) &(bens_rec).post;
734 #line 470 "can.ec"
735  _sqobind[12].sqldata = (bens_rec).new_report;
736 #line 470 "can.ec"
737  _sqobind[13].sqldata = (bens_rec).active;
738 #line 470 "can.ec"
739  _sqobind[14].sqldata = (bens_rec).rfs;
740 #line 470 "can.ec"
741  _sqobind[15].sqldata = (char *) &(bens_rec).obstime;
742 #line 470 "can.ec"
743  _sqobind[16].sqldata = (bens_rec).prod;
744 #line 470 "can.ec"
745  _sqobind[17].sqldata = (bens_rec).prod2ary;
746 #line 470 "can.ec"
747  _sqobind[18].sqldata = (bens_rec).obsag;
748 #line 470 "can.ec"
749  _sqobind[19].sqldata = (bens_rec).obsloc;
750 #line 470 "can.ec"
751  _sqobind[20].sqldata = (bens_rec).prov_avail;
752 #line 470 "can.ec"
753  _sqobind[21].sqldata = (bens_rec).final_avail;
754 #line 470 "can.ec"
755  _sqobind[22].sqldata = (bens_rec).ownag;
756 #line 470 "can.ec"
757  _sqobind[23].sqldata = (bens_rec).ownloc;
758 #line 470 "can.ec"
759  _sqobind[24].sqldata = (bens_rec).maintag;
760 #line 470 "can.ec"
761  _sqobind[25].sqldata = (bens_rec).maintloc;
762 #line 470 "can.ec"
763  _sqobind[26].sqldata = (bens_rec).init;
764 #line 470 "can.ec"
765  _sqobind[27].sqldata = (bens_rec).dbsource;
766 #line 470 "can.ec"
767  _iqslct(&_SQ0, (char **) sqlcmdtxt, 2, _sqibind, 28, _sqobind, 0);
768 #line 470 "can.ec"
769  }
770 
771 
772 
773 
774  if(sqlca.sqlcode < 0) {
775 
776  printf("database error\n %d",sqlca.sqlcode);
777  exit(1);
778 
779  }
780 
781  if(sqlca.sqlcode == 100)
782  continue;
783 
784  if(toupper(bens_rec.active[0])!='Y')
785  continue;
786 
787  pc[0]=bens_rec.pe1[0];
788  pc[1]=bens_rec.pe2[0];
789  pc[2]=bens_rec.dur[0];
790  pc[3]=bens_rec.t[0];
791  pc[4]=bens_rec.s[0];
792  pc[5]=bens_rec.e[0];
793  pc[6]=bens_rec.p[0];
794  pc[7]=0;
795 
796  strcpy(name,btn_rec.des);
797 
798  ival=atoi(btn_rec.lat);
799  len=strlen(btn_rec.lat);
800 
801  if(ival < 10000) {
802 
803  itemp=ival/100;
804 
805  itemp1=ival-itemp*100;
806 
807  flat=(float)itemp+(float)itemp1/60;
808 
809 
810  }
811 
812  else if(ival > 10000) {
813 
814  itemp=ival/10000;
815 
816  itemp1=(ival-itemp*10000)/100;
817 
818  itemp2=ival-itemp*10000-itemp1*100;
819 
820  flat=(float)itemp+(float)itemp1/60 + (float)itemp2/3600;
821 
822 
823 
824  }
825 
826  else {
827 
828  printf("error\n");
829 
830  continue;
831 
832  }
833 
834 
835  ival=atoi(btn_rec.lng);
836  len=strlen(btn_rec.lng);
837 
838  if(ival < 100000) {
839 
840  itemp=ival/100;
841 
842  itemp1=ival-itemp*100;
843 
844  flng=(float)itemp+(float)itemp1/60;
845 
846 
847  }
848 
849  else if(ival >=100000) {
850 
851  itemp=ival/10000;
852 
853  itemp1=(ival-itemp*10000)/100;
854 
855  itemp2=ival-itemp*10000-itemp1*100;
856 
857  flng=(float)itemp+(float)itemp1/60 + (float)itemp2/3600;
858 
859  }
860 
861  else {
862 
863  printf("error\n");
864 
865  continue;
866 
867  }
868 
869 
870  /* if(flat <38.3 || flat > 39.4 ||
871  flng < 107.2 || flng > 107.8)
872  continue;*/
873 
874  printf("%s %s %f %f %d %d %s\n",
875  btn_rec.id,pc,flat,flng,btn_rec.elev,tip,btn_rec.des);
876 
877 
878  }
879 
880 
881 /*}
882  */
883 
884 }
885 
886 #line 585 "can.ec"
struct data_rec data_record
long SQLCODE
char pe2
Definition: can.c:123
static const char * _Cn1
Definition: can.c:8
int mday[]
Definition: can.c:353
char s
Definition: can.c:123
void main(int argc, char **argv)
Definition: can.c:354
struct eens_rec bens_rec
char pe1
Definition: can.c:123
struct pro_dly_rec dly_rec
char SQLSTATE[]
struct sqlca_s sqlca
struct pro_hrly_rec hrly_rec
_SQCURSOR * _iqnprep()
char dur
Definition: can.c:123
struct gage_info info
char t
Definition: can.c:123
struct etn_rec btn_rec
int maxdays
Definition: daily_qc.c:85
time_t btim
Definition: daily_qc.c:140
time_t tim
Definition: daily_qc.c:154
char type[5]
Definition: daily_qc.c:98
int hour
Definition: display_data.c:30
char qual[10]
Definition: display_data.c:29
int day
Definition: display_data.c:30
struct stim etim
Definition: display_data.c:21
int year
Definition: display_data.c:30
int month
Definition: display_data.c:30
void init_candidate()
Definition: init_candidate.c:9
printf("pcp %d\n", pcp_in_use[103])
exit(1)
int rfs(int)
Definition: can.c:329
int idote
Definition: can.c:346
int cztime
Definition: can.c:342
char source[9]
Definition: can.c:331
char pe2
Definition: can.c:333
char t
Definition: can.c:335
char s
Definition: can.c:336
int irev
Definition: can.c:347
char p
Definition: can.c:338
double values[96]
Definition: can.c:349
char lwal
Definition: can.c:345
int zdate
Definition: can.c:339
char lwals[96]
Definition: can.c:350
int idur
Definition: can.c:343
int ztime
Definition: can.c:340
char pedtsep[8]
Definition: can.c:351
double codp
Definition: can.c:344
char dur
Definition: can.c:334
char pe1
Definition: can.c:332
double value
Definition: can.c:348
char e
Definition: can.c:337
int czdate
Definition: can.c:341
Definition: can.c:293
char dbsource[4]
Definition: can.c:321
char maintag[7]
Definition: can.c:318
char maintloc[4]
Definition: can.c:319
char obsag[7]
Definition: can.c:312
char pe1[2]
Definition: can.c:295
char e[2]
Definition: can.c:300
char det[41]
Definition: can.c:304
char active[2]
Definition: can.c:307
char p[2]
Definition: can.c:301
char init[9]
Definition: can.c:320
char pe2[2]
Definition: can.c:296
char des[51]
Definition: can.c:303
char prod[10]
Definition: can.c:310
char prov_avail[2]
Definition: can.c:314
char prod2ary[10]
Definition: can.c:311
char rfs[2]
Definition: can.c:308
char type[2]
Definition: can.c:302
char obsloc[4]
Definition: can.c:313
char t[2]
Definition: can.c:298
char dur[2]
Definition: can.c:297
char new_report[2]
Definition: can.c:306
char s[2]
Definition: can.c:299
char ownag[7]
Definition: can.c:316
char final_avail[8]
Definition: can.c:315
int obstime
Definition: can.c:309
char ownloc[4]
Definition: can.c:317
int post
Definition: can.c:305
char det[41]
Definition: build_list.c:129
char huc[9]
Definition: build_list.c:135
char init[9]
Definition: build_list.c:130
int elev
Definition: build_list.c:133
char plat[9]
Definition: build_list.c:127
char des[51]
Definition: build_list.c:128
char id[6]
Definition: build_list.c:126
char lng[8]
Definition: build_list.c:132
char cwa[4]
Definition: build_list.c:139
char dbsource[4]
Definition: build_list.c:141
char lat[7]
Definition: build_list.c:131
char cou[4]
Definition: build_list.c:136
char zon[5]
Definition: build_list.c:137
int post
Definition: build_list.c:140
char hsa[4]
Definition: build_list.c:138
char stat[3]
Definition: build_list.c:134
Definition: can.c:144
char pe2[2]
Definition: can.c:147
char dur[2]
Definition: can.c:148
char p[2]
Definition: can.c:152
char s[2]
Definition: can.c:150
char pe1[2]
Definition: can.c:146
char t[2]
Definition: can.c:149
char mode[2]
Definition: can.c:153
char e[2]
Definition: can.c:151
char qzday06[2]
Definition: can.c:265
double zday10
Definition: can.c:238
double zday04
Definition: can.c:232
char qzday19[2]
Definition: can.c:278
char qzday17[2]
Definition: can.c:276
double zday17
Definition: can.c:245
char qzday29[2]
Definition: can.c:288
double zday11
Definition: can.c:239
double zday08
Definition: can.c:236
double zday28
Definition: can.c:256
char qzday01[2]
Definition: can.c:260
char e[2]
Definition: can.c:225
double zday26
Definition: can.c:254
char pe2[2]
Definition: can.c:221
char qzday13[2]
Definition: can.c:272
char t[2]
Definition: can.c:223
double zday18
Definition: can.c:246
char qzday04[2]
Definition: can.c:263
int cal_yr
Definition: can.c:227
double zday15
Definition: can.c:243
char qzday05[2]
Definition: can.c:264
char qzday16[2]
Definition: can.c:275
char qzday26[2]
Definition: can.c:285
double zday22
Definition: can.c:250
double zday31
Definition: can.c:259
double zday09
Definition: can.c:237
char qzday30[2]
Definition: can.c:289
char qzday28[2]
Definition: can.c:287
char qzday08[2]
Definition: can.c:267
char qzday25[2]
Definition: can.c:284
double zday30
Definition: can.c:258
double zday05
Definition: can.c:233
double zday14
Definition: can.c:242
double zday01
Definition: can.c:229
char pe1[2]
Definition: can.c:220
double zday23
Definition: can.c:251
double zday20
Definition: can.c:248
double zday27
Definition: can.c:255
double zday07
Definition: can.c:235
char qzday14[2]
Definition: can.c:273
char qzday15[2]
Definition: can.c:274
double zday06
Definition: can.c:234
char qzday09[2]
Definition: can.c:268
char qzday21[2]
Definition: can.c:280
double zday19
Definition: can.c:247
char qzday23[2]
Definition: can.c:282
char qzday31[2]
Definition: can.c:290
char qzday27[2]
Definition: can.c:286
char qzday07[2]
Definition: can.c:266
double zday02
Definition: can.c:230
char p[2]
Definition: can.c:226
double zday24
Definition: can.c:252
char qzday22[2]
Definition: can.c:281
double zday12
Definition: can.c:240
double zday13
Definition: can.c:241
char qzday12[2]
Definition: can.c:271
double zday03
Definition: can.c:231
char s[2]
Definition: can.c:224
double zday21
Definition: can.c:249
char qzday24[2]
Definition: can.c:283
double zday16
Definition: can.c:244
int mon
Definition: can.c:228
char qzday20[2]
Definition: can.c:279
double zday29
Definition: can.c:257
double zday25
Definition: can.c:253
char qzday02[2]
Definition: can.c:261
char dur[2]
Definition: can.c:222
char qzday18[2]
Definition: can.c:277
char qzday10[2]
Definition: can.c:269
char qzday03[2]
Definition: can.c:262
char qzday11[2]
Definition: can.c:270
char qzhr05[2]
Definition: can.c:197
double zhr02
Definition: can.c:170
char qzhr14[2]
Definition: can.c:206
double zhr01
Definition: can.c:169
double zhr16
Definition: can.c:184
double zhr21
Definition: can.c:189
char qzhr11[2]
Definition: can.c:203
double zhr15
Definition: can.c:183
char qzhr21[2]
Definition: can.c:213
char dur[2]
Definition: can.c:160
char qzhr10[2]
Definition: can.c:202
char p[2]
Definition: can.c:164
double zhr22
Definition: can.c:190
char qzhr01[2]
Definition: can.c:193
char qzhr20[2]
Definition: can.c:212
char qzhr02[2]
Definition: can.c:194
int mon
Definition: can.c:166
double zhr05
Definition: can.c:173
double zhr11
Definition: can.c:179
char qzhr12[2]
Definition: can.c:204
double zhr00
Definition: can.c:168
double zhr23
Definition: can.c:191
double zhr12
Definition: can.c:180
char qzhr23[2]
Definition: can.c:215
char qzhr00[2]
Definition: can.c:192
double zhr03
Definition: can.c:171
double zhr17
Definition: can.c:185
char pe1[2]
Definition: can.c:158
char qzhr08[2]
Definition: can.c:200
double zhr14
Definition: can.c:182
double zhr06
Definition: can.c:174
double zhr10
Definition: can.c:178
char qzhr13[2]
Definition: can.c:205
char qzhr15[2]
Definition: can.c:207
double zhr13
Definition: can.c:181
char qzhr17[2]
Definition: can.c:209
char qzhr16[2]
Definition: can.c:208
int zday
Definition: can.c:167
char s[2]
Definition: can.c:162
char t[2]
Definition: can.c:161
int cal_yr
Definition: can.c:165
char qzhr03[2]
Definition: can.c:195
double zhr20
Definition: can.c:188
char qzhr06[2]
Definition: can.c:198
double zhr08
Definition: can.c:176
double zhr19
Definition: can.c:187
char pe2[2]
Definition: can.c:159
double zhr18
Definition: can.c:186
char qzhr18[2]
Definition: can.c:210
double zhr04
Definition: can.c:172
char qzhr19[2]
Definition: can.c:211
double zhr09
Definition: can.c:177
char qzhr04[2]
Definition: can.c:196
char qzhr09[2]
Definition: can.c:201
char e[2]
Definition: can.c:163
char qzhr22[2]
Definition: can.c:214
double zhr07
Definition: can.c:175
char qzhr07[2]
Definition: can.c:199
long sqlerrd[6]
Definition: build_list.c:50
long sqlcode
Definition: build_list.c:47
struct sqlca_s::sqlcaw_s sqlwarn
char sqlerrm[72]
Definition: build_list.c:48
char sqlerrp[8]
Definition: build_list.c:49
Definition: misc.h:55
int minute
Definition: misc.h:61
int day
Definition: misc.h:59
int year
Definition: misc.h:57
int hour
Definition: misc.h:60
int month
Definition: misc.h:58