Daily_QC
rat.c
Go to the documentation of this file.
1 #include <sqlhdr.h>
2 #include <sqliapi.h>
3 static const char _Cn2[] = "ratecursor";
4 static const char _Cn1[] = "shiftcursor";
5 #line 1 "rat.ec"
6 /**************************************************************
7  rat.ec: queries database for rating table and shift table.
8  functions to get the flow given a stage, and
9  functions to get the stage given the flow
10  author: Brandi Kraft
11  date: 8/95
12 **************************************************************/
13 
14 #include "rate_table.h"
15 #include <math.h>
16 /*
17  * EXEC SQL include sqlca.h;
18  */
19 #line 11 "rat.ec"
20 
21 #line 11 "rat.ec"
22 #line 1 "/opt/informix/incl/esql/sqlca.h"
23 /****************************************************************************
24  *
25  * IBM INC.
26  *
27  * PROPRIETARY DATA
28  *
29  * Licensed Material - Property Of IBM
30  *
31  * "Restricted Materials of IBM"
32  *
33  * IBM Informix Client SDK
34  *
35  * (c) Copyright IBM Corporation 1997, 2004. All rights reserved.
36  *
37  * Title: sqlca.h
38  * Description:
39  * SQL Control Area
40  *
41  ***************************************************************************
42  */
43 
44 #ifndef SQLCA_INCL
45 #define SQLCA_INCL
46 
47 #include "ifxtypes.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 typedef struct sqlca_s
54  {
55  int4 sqlcode;
56 #ifdef DB2CLI
57  char sqlerrm[600]; /* error message parameters */
58 #else /* DB2CLI */
59  char sqlerrm[72]; /* error message parameters */
60 #endif /* DB2CLI */
61  char sqlerrp[8];
62  int4 sqlerrd[6];
63  /* 0 - estimated number of rows returned */
64  /* 1 - serial value after insert or ISAM error code */
65  /* 2 - number of rows processed */
66  /* 3 - estimated cost */
67  /* 4 - offset of the error into the SQL statement */
68  /* 5 - rowid after insert */
69 #ifdef _FGL_
70  char sqlawarn[8];
71 #else
72  struct sqlcaw_s
73  {
74  char sqlwarn0; /* = W if any of sqlwarn[1-7] = W */
75  char sqlwarn1; /* = W if any truncation occurred or
76  database has transactions or
77  no privileges revoked */
78  char sqlwarn2; /* = W if a null value returned or
79  ANSI database */
80  char sqlwarn3; /* = W if no. in select list != no. in into list or
81  turbo backend or no privileges granted */
82  char sqlwarn4; /* = W if no where clause on prepared update, delete or
83  incompatible float format */
84  char sqlwarn5; /* = W if non-ANSI statement */
85  char sqlwarn6; /* = W if server is in data replication secondary mode */
86  char sqlwarn7; /* = W if database locale is different from proc_locale
87  = W if backend XPS and if explain avoid_execute is set
88  (for select, insert, delete and update only)
89  */
90  } sqlwarn;
91 #endif
93 
94 /* NOTE: 4gl assumes that the sqlwarn structure can be defined as
95  * sqlawarn -- an 8 character string, because single-char
96  * variables are not recognized in 4gl.
97  *
98  * If this structure should change, the code generated by 4gl compiler
99  * must also change
100  */
101 
102 #ifdef VMS
103 noshare
104 #endif /* VMS */
105 
106 #define SQLNOTFOUND 100
107 
108 #ifndef IFX_THREAD
109 #ifdef DB2CLI
110 #define sqlca ifmxsqlca
111 extern struct sqlca_s sqlca;
112 #else /* DB2CLI */
113 extern struct sqlca_s sqlca;
114 #endif /* DB2CLI */
115 
116 extern int4 SQLCODE;
117 
118 extern char SQLSTATE[];
119 #else /* IFX_THREAD */
120 extern int4 * ifx_sqlcode();
121 extern struct sqlca_s * ifx_sqlca();
122 #define SQLCODE (*(ifx_sqlcode()))
123 #define SQLSTATE ((char *)(ifx_sqlstate()))
124 #define sqlca (*(ifx_sqlca()))
125 #endif /* IFX_THREAD */
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* SQLCA_INCL */
132 
133 #line 110 "/opt/informix/incl/esql/sqlca.h"
134 #line 12 "rat.ec"
135 
136 static char savehb5[10];
137 static char savepe1, savepe2;
141 static int max;
142 static double Val[10],Sh[10],Slope, b,stg_int;
143 
144 
145 /*-----------------------------------------------------------------------
146  get_rate: given a hb5 id, the pedstep parameters ,and the date,
147  queries database for the rating table and shift table,
148  and fetches it into the stuctures table and shtable.
149  Then assigns data from those structures to the structure
150  rate_table defined in the file rate_table.h
151 -------------------------------------------------------------------*/
152 int get_rate(char *hb5in,char pe1,char pe2,int zdate)
153 {
154 int i,j, zero_flow = 0;
155 
156 
157 /*
158  * EXEC SQL BEGIN DECLARE SECTION;
159  */
160 #line 34 "rat.ec"
161 #line 35 "rat.ec"
162  char hb5[6];
163 int table_version;
164  char p1, p2;
165 struct table
166  {
167  char id[6];
168  char pe1[2];
169  char pe2[2];
170  int tbl;
171  int valid_date;
172  int gs;
173  int src;
174  int fix;
175  int datacol;
176  int ver5;
177  double fld;
178  double wrn;
179  double hist_stg;
180  int hist_q;
181  int hist_date;
182  int spil;
183  int ded;
184  int cap;
185  double stg001;
186  double stg002;
187  double stg003;
188  double stg004;
189  double stg005;
190  double stg006;
191  double stg007;
192  double stg008;
193  double stg009;
194  double stg010;
195  double stg011;
196  double stg012;
197  double stg013;
198  double stg014;
199  double stg015;
200  double stg016;
201  double stg017;
202  double stg018;
203  double stg019;
204  double stg020;
205  double stg021;
206  double stg022;
207  double stg023;
208  double stg024;
209  double stg025;
210  double stg026;
211  double stg027;
212  double stg028;
213  double stg029;
214  double stg030;
215  double stg031;
216  double stg032;
217  double stg033;
218  double stg034;
219  double stg035;
220  double stg036;
221  double stg037;
222  double stg038;
223  double stg039;
224  double stg040;
225  double stg041;
226  double stg042;
227  double stg043;
228  double stg044;
229  double stg045;
230  double stg046;
231  double stg047;
232  double stg048;
233  double stg049;
234  double stg050;
235  double stg051;
236  double stg052;
237  double stg053;
238  double stg054;
239  double stg055;
240  double stg056;
241  double stg057;
242  double stg058;
243  double stg059;
244  double stg060;
245  double stg061;
246  double stg062;
247  double stg063;
248  double stg064;
249  double stg065;
250  double stg066;
251  double stg067;
252  double stg068;
253  double stg069;
254  double stg070;
255  double stg071;
256  double stg072;
257  double stg073;
258  double stg074;
259  double stg075;
260  double stg076;
261  double stg077;
262  double stg078;
263  double stg079;
264  double stg080;
265  double stg081;
266  double stg082;
267  double stg083;
268  double stg084;
269  double stg085;
270  double stg086;
271  double stg087;
272  double stg088;
273  double stg089;
274  double stg090;
275  double stg091;
276  double stg092;
277  double stg093;
278  double stg094;
279  double stg095;
280  double stg096;
281  double stg097;
282  double stg098;
283  double stg099;
284  double stg100;
285  int q001;
286  int q002;
287  int q003;
288  int q004;
289  int q005;
290  int q006;
291  int q007;
292  int q008;
293  int q009;
294  int q010;
295  int q011;
296  int q012;
297  int q013;
298  int q014;
299  int q015;
300  int q016;
301  int q017;
302  int q018;
303  int q019;
304  int q020;
305  int q021;
306  int q022;
307  int q023;
308  int q024;
309  int q025;
310  int q026;
311  int q027;
312  int q028;
313  int q029;
314  int q030;
315  int q031;
316  int q032;
317  int q033;
318  int q034;
319  int q035;
320  int q036;
321  int q037;
322  int q038;
323  int q039;
324  int q040;
325  int q041;
326  int q042;
327  int q043;
328  int q044;
329  int q045;
330  int q046;
331  int q047;
332  int q048;
333  int q049;
334  int q050;
335  int q051;
336  int q052;
337  int q053;
338  int q054;
339  int q055;
340  int q056;
341  int q057;
342  int q058;
343  int q059;
344  int q060;
345  int q061;
346  int q062;
347  int q063;
348  int q064;
349  int q065;
350  int q066;
351  int q067;
352  int q068;
353  int q069;
354  int q070;
355  int q071;
356  int q072;
357  int q073;
358  int q074;
359  int q075;
360  int q076;
361  int q077;
362  int q078;
363  int q079;
364  int q080;
365  int q081;
366  int q082;
367  int q083;
368  int q084;
369  int q085;
370  int q086;
371  int q087;
372  int q088;
373  int q089;
374  int q090;
375  int q091;
376  int q092;
377  int q093;
378  int q094;
379  int q095;
380  int q096;
381  int q097;
382  int q098;
383  int q099;
384  int q100;
385  } table;
386 struct shtable
387  {
388  char id[6];
389  char pe1[2];
390  char pe2[2];
391  int begin_date;
392  int tbl_ver;
393  double val_a;
394  double sh_a;
395  double val_b;
396  double sh_b;
397  double val_c;
398  double sh_c;
399  double val_d;
400  double sh_d;
401  } shtable;
402 struct eens_rec
403  {
404  char id[6];
405  char pe1[2];
406  char pe2[2];
407  char dur[2];
408  char t[2];
409  char s[2];
410  char e[2];
411  char p[2];
412  char type[2];
413  char des[51];
414  char det[41];
415  int post;
416  char new_report[2];
417  char active[2];
418  char ok[2];
419  char rfs[2];
420  int obstime;
421  char prod[10];
422  char prod2ary[10];
423  char obsag[7];
424  char obsloc[4];
425  char prov_avail[2];
426  char final_avail[8];
427  char ownag[7];
428  char ownloc[4];
429  char maintag[7];
430  char maintloc[4];
431  char init[9];
432  char dbsource[4];
433  } bens_rec;
434 /*
435  * EXEC SQL END DECLARE SECTION;
436  */
437 #line 310 "rat.ec"
438 
439 
440 /*
441  * exec sql set isolation to dirty read;
442  */
443 #line 312 "rat.ec"
444  {
445 #line 312 "rat.ec"
446  static const char *sqlcmdtxt[] =
447 #line 312 "rat.ec"
448  {
449 #line 312 "rat.ec"
450  "set isolation to dirty read",
451  0
452  };
453 #line 312 "rat.ec"
454  static ifx_statement_t _SQ0 = {0};
455 #line 312 "rat.ec"
456  sqli_stmt(ESQLINTVERSION, &_SQ0, sqlcmdtxt, 0, (ifx_sqlvar_t *)0, (struct value *)0, (ifx_literal_t *)0, (ifx_namelist_t *)0, (ifx_cursor_t *)0, -1, 0, 0);
457 #line 312 "rat.ec"
458  }
459 
460 p1 = pe1;
461 p2 = pe2;
462 
463 strcpy(hb5,hb5in);
464 
465 printf("%s %c %c\n",hb5,pe1,pe2);
466 
467 for(i=0;i<4;i++) {
468 
469  Val[i]=0;
470  Sh[i]=0;
471 
472  }
473 
474 /*
475  * EXEC SQL open shiftcursor using: hb5, :p1, :p2;
476  */
477 #line 328 "rat.ec"
478  {
479 #line 328 "rat.ec"
480  static ifx_sqlvar_t _sqibind[] =
481  {
482  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
483  { 108, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
484  { 108, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
485 #line 328 "rat.ec"
486  };
487  static ifx_sqlda_t _SD0 = { 3, _sqibind, {0}, 3, 0 };
488 #line 328 "rat.ec"
489  _sqibind[0].sqldata = hb5;
490 #line 328 "rat.ec"
491  _sqibind[1].sqldata = &p1;
492 #line 328 "rat.ec"
493  _sqibind[2].sqldata = &p2;
494  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn1, 768), &_SD0, (char *)0, (struct value *)0, 1, 0);
495 #line 328 "rat.ec"
496  }
497 if(sqlca.sqlcode != 0)
498  return(sqlca.sqlcode);
499 
500 for(i = 0; i < 100; i++)
501 {
502 /*
503  * EXEC SQL fetch shiftcursor into: shtable;
504  */
505 #line 334 "rat.ec"
506  {
507 #line 334 "rat.ec"
508  static ifx_sqlvar_t _sqobind[] =
509  {
510  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
511  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
512  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
513  { 102, sizeof((shtable).begin_date), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
514  { 102, sizeof((shtable).tbl_ver), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
515  { 105, sizeof((shtable).val_a), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
516  { 105, sizeof((shtable).sh_a), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
517  { 105, sizeof((shtable).val_b), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
518  { 105, sizeof((shtable).sh_b), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
519  { 105, sizeof((shtable).val_c), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
520  { 105, sizeof((shtable).sh_c), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
521  { 105, sizeof((shtable).val_d), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
522  { 105, sizeof((shtable).sh_d), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
523 #line 334 "rat.ec"
524  };
525  static ifx_sqlda_t _SD0 = { 13, _sqobind, {0}, 13, 0 };
526  static _FetchSpec _FS1 = { 0, 1, 0 };
527 #line 334 "rat.ec"
528  _sqobind[0].sqldata = (shtable).id;
529 #line 334 "rat.ec"
530  _sqobind[1].sqldata = (shtable).pe1;
531 #line 334 "rat.ec"
532  _sqobind[2].sqldata = (shtable).pe2;
533 #line 334 "rat.ec"
534  _sqobind[3].sqldata = (char *) &(shtable).begin_date;
535 #line 334 "rat.ec"
536  _sqobind[4].sqldata = (char *) &(shtable).tbl_ver;
537 #line 334 "rat.ec"
538  _sqobind[5].sqldata = (char *) &(shtable).val_a;
539 #line 334 "rat.ec"
540  _sqobind[6].sqldata = (char *) &(shtable).sh_a;
541 #line 334 "rat.ec"
542  _sqobind[7].sqldata = (char *) &(shtable).val_b;
543 #line 334 "rat.ec"
544  _sqobind[8].sqldata = (char *) &(shtable).sh_b;
545 #line 334 "rat.ec"
546  _sqobind[9].sqldata = (char *) &(shtable).val_c;
547 #line 334 "rat.ec"
548  _sqobind[10].sqldata = (char *) &(shtable).sh_c;
549 #line 334 "rat.ec"
550  _sqobind[11].sqldata = (char *) &(shtable).val_d;
551 #line 334 "rat.ec"
552  _sqobind[12].sqldata = (char *) &(shtable).sh_d;
553  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn1, 768), (ifx_sqlda_t *)0, &_SD0, (char *)0, &_FS1);
554 #line 334 "rat.ec"
555  }
556 
557 if(sqlca.sqlcode < 0)
558  return(sqlca.sqlcode);
559 
560 if(sqlca.sqlcode == 100)
561  return(-1);
562 
563 if(zdate >= shtable.begin_date)
564  break;
565 
566 rate_table.edate=shtable.begin_date;
567 
568 }
569 
570 rate_table.tbl_ver = shtable.tbl_ver;
571 
572 if(i==0)
573  rate_table.edate=-1;
574 
575 rate_table.Shift.Val[0] = shtable.val_a;
576 rate_table.Shift.Val[1] = shtable.val_b;
577 rate_table.Shift.Val[2] = shtable.val_c;
578 rate_table.Shift.Val[3] = shtable.val_d;
579 rate_table.Shift.Sh[0] = shtable.sh_a;
580 rate_table.Shift.Sh[1] = shtable.sh_b;
581 rate_table.Shift.Sh[2] = shtable.sh_c;
582 rate_table.Shift.Sh[3] = shtable.sh_d;
583 
584 rate_table.bdate=shtable.begin_date;
585 
586 /*
587  * EXEC SQL close shiftcursor;
588  */
589 #line 365 "rat.ec"
590  {
591 #line 365 "rat.ec"
592  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn1, 768));
593 #line 365 "rat.ec"
594  }
595 
596 strcpy(hb5,hb5in);
597 table_version=shtable.tbl_ver;
598 
599 /*
600  * EXEC SQL open ratecursor using :hb5, :p1, :p2, :table_version;
601  */
602 #line 370 "rat.ec"
603  {
604 #line 370 "rat.ec"
605  static ifx_sqlvar_t _sqibind[] =
606  {
607  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
608  { 108, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
609  { 108, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
610  { 102, sizeof(table_version), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
611 #line 370 "rat.ec"
612  };
613  static ifx_sqlda_t _SD0 = { 4, _sqibind, {0}, 4, 0 };
614 #line 370 "rat.ec"
615  _sqibind[0].sqldata = hb5;
616 #line 370 "rat.ec"
617  _sqibind[1].sqldata = &p1;
618 #line 370 "rat.ec"
619  _sqibind[2].sqldata = &p2;
620 #line 370 "rat.ec"
621  _sqibind[3].sqldata = (char *) &table_version;
622  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn2, 768), &_SD0, (char *)0, (struct value *)0, 1, 0);
623 #line 370 "rat.ec"
624  }
625 if(sqlca.sqlcode != 0)
626  return(sqlca.sqlcode);
627 
628 /*
629  * EXEC SQL fetch ratecursor into: table;
630  */
631 #line 374 "rat.ec"
632  {
633 #line 374 "rat.ec"
634  static ifx_sqlvar_t _sqobind[] =
635  {
636  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
637  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
638  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
639  { 102, sizeof((table).tbl), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
640  { 102, sizeof((table).valid_date), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
641  { 102, sizeof((table).gs), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
642  { 102, sizeof((table).src), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
643  { 102, sizeof((table).fix), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
644  { 102, sizeof((table).datacol), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
645  { 102, sizeof((table).ver5), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
646  { 105, sizeof((table).fld), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
647  { 105, sizeof((table).wrn), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
648  { 105, sizeof((table).hist_stg), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
649  { 102, sizeof((table).hist_q), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
650  { 102, sizeof((table).hist_date), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
651  { 102, sizeof((table).spil), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
652  { 102, sizeof((table).ded), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
653  { 102, sizeof((table).cap), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
654  { 105, sizeof((table).stg001), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
655  { 105, sizeof((table).stg002), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
656  { 105, sizeof((table).stg003), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
657  { 105, sizeof((table).stg004), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
658  { 105, sizeof((table).stg005), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
659  { 105, sizeof((table).stg006), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
660  { 105, sizeof((table).stg007), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
661  { 105, sizeof((table).stg008), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
662  { 105, sizeof((table).stg009), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
663  { 105, sizeof((table).stg010), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
664  { 105, sizeof((table).stg011), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
665  { 105, sizeof((table).stg012), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
666  { 105, sizeof((table).stg013), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
667  { 105, sizeof((table).stg014), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
668  { 105, sizeof((table).stg015), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
669  { 105, sizeof((table).stg016), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
670  { 105, sizeof((table).stg017), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
671  { 105, sizeof((table).stg018), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
672  { 105, sizeof((table).stg019), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
673  { 105, sizeof((table).stg020), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
674  { 105, sizeof((table).stg021), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
675  { 105, sizeof((table).stg022), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
676  { 105, sizeof((table).stg023), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
677  { 105, sizeof((table).stg024), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
678  { 105, sizeof((table).stg025), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
679  { 105, sizeof((table).stg026), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
680  { 105, sizeof((table).stg027), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
681  { 105, sizeof((table).stg028), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
682  { 105, sizeof((table).stg029), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
683  { 105, sizeof((table).stg030), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
684  { 105, sizeof((table).stg031), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
685  { 105, sizeof((table).stg032), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
686  { 105, sizeof((table).stg033), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
687  { 105, sizeof((table).stg034), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
688  { 105, sizeof((table).stg035), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
689  { 105, sizeof((table).stg036), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
690  { 105, sizeof((table).stg037), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
691  { 105, sizeof((table).stg038), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
692  { 105, sizeof((table).stg039), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
693  { 105, sizeof((table).stg040), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
694  { 105, sizeof((table).stg041), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
695  { 105, sizeof((table).stg042), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
696  { 105, sizeof((table).stg043), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
697  { 105, sizeof((table).stg044), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
698  { 105, sizeof((table).stg045), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
699  { 105, sizeof((table).stg046), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
700  { 105, sizeof((table).stg047), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
701  { 105, sizeof((table).stg048), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
702  { 105, sizeof((table).stg049), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
703  { 105, sizeof((table).stg050), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
704  { 105, sizeof((table).stg051), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
705  { 105, sizeof((table).stg052), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
706  { 105, sizeof((table).stg053), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
707  { 105, sizeof((table).stg054), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
708  { 105, sizeof((table).stg055), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
709  { 105, sizeof((table).stg056), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
710  { 105, sizeof((table).stg057), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
711  { 105, sizeof((table).stg058), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
712  { 105, sizeof((table).stg059), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
713  { 105, sizeof((table).stg060), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
714  { 105, sizeof((table).stg061), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
715  { 105, sizeof((table).stg062), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
716  { 105, sizeof((table).stg063), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
717  { 105, sizeof((table).stg064), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
718  { 105, sizeof((table).stg065), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
719  { 105, sizeof((table).stg066), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
720  { 105, sizeof((table).stg067), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
721  { 105, sizeof((table).stg068), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
722  { 105, sizeof((table).stg069), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
723  { 105, sizeof((table).stg070), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
724  { 105, sizeof((table).stg071), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
725  { 105, sizeof((table).stg072), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
726  { 105, sizeof((table).stg073), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
727  { 105, sizeof((table).stg074), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
728  { 105, sizeof((table).stg075), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
729  { 105, sizeof((table).stg076), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
730  { 105, sizeof((table).stg077), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
731  { 105, sizeof((table).stg078), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
732  { 105, sizeof((table).stg079), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
733  { 105, sizeof((table).stg080), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
734  { 105, sizeof((table).stg081), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
735  { 105, sizeof((table).stg082), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
736  { 105, sizeof((table).stg083), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
737  { 105, sizeof((table).stg084), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
738  { 105, sizeof((table).stg085), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
739  { 105, sizeof((table).stg086), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
740  { 105, sizeof((table).stg087), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
741  { 105, sizeof((table).stg088), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
742  { 105, sizeof((table).stg089), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
743  { 105, sizeof((table).stg090), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
744  { 105, sizeof((table).stg091), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
745  { 105, sizeof((table).stg092), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
746  { 105, sizeof((table).stg093), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
747  { 105, sizeof((table).stg094), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
748  { 105, sizeof((table).stg095), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
749  { 105, sizeof((table).stg096), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
750  { 105, sizeof((table).stg097), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
751  { 105, sizeof((table).stg098), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
752  { 105, sizeof((table).stg099), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
753  { 105, sizeof((table).stg100), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
754  { 102, sizeof((table).q001), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
755  { 102, sizeof((table).q002), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
756  { 102, sizeof((table).q003), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
757  { 102, sizeof((table).q004), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
758  { 102, sizeof((table).q005), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
759  { 102, sizeof((table).q006), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
760  { 102, sizeof((table).q007), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
761  { 102, sizeof((table).q008), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
762  { 102, sizeof((table).q009), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
763  { 102, sizeof((table).q010), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
764  { 102, sizeof((table).q011), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
765  { 102, sizeof((table).q012), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
766  { 102, sizeof((table).q013), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
767  { 102, sizeof((table).q014), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
768  { 102, sizeof((table).q015), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
769  { 102, sizeof((table).q016), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
770  { 102, sizeof((table).q017), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
771  { 102, sizeof((table).q018), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
772  { 102, sizeof((table).q019), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
773  { 102, sizeof((table).q020), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
774  { 102, sizeof((table).q021), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
775  { 102, sizeof((table).q022), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
776  { 102, sizeof((table).q023), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
777  { 102, sizeof((table).q024), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
778  { 102, sizeof((table).q025), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
779  { 102, sizeof((table).q026), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
780  { 102, sizeof((table).q027), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
781  { 102, sizeof((table).q028), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
782  { 102, sizeof((table).q029), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
783  { 102, sizeof((table).q030), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
784  { 102, sizeof((table).q031), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
785  { 102, sizeof((table).q032), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
786  { 102, sizeof((table).q033), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
787  { 102, sizeof((table).q034), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
788  { 102, sizeof((table).q035), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
789  { 102, sizeof((table).q036), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
790  { 102, sizeof((table).q037), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
791  { 102, sizeof((table).q038), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
792  { 102, sizeof((table).q039), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
793  { 102, sizeof((table).q040), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
794  { 102, sizeof((table).q041), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
795  { 102, sizeof((table).q042), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
796  { 102, sizeof((table).q043), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
797  { 102, sizeof((table).q044), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
798  { 102, sizeof((table).q045), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
799  { 102, sizeof((table).q046), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
800  { 102, sizeof((table).q047), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
801  { 102, sizeof((table).q048), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
802  { 102, sizeof((table).q049), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
803  { 102, sizeof((table).q050), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
804  { 102, sizeof((table).q051), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
805  { 102, sizeof((table).q052), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
806  { 102, sizeof((table).q053), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
807  { 102, sizeof((table).q054), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
808  { 102, sizeof((table).q055), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
809  { 102, sizeof((table).q056), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
810  { 102, sizeof((table).q057), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
811  { 102, sizeof((table).q058), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
812  { 102, sizeof((table).q059), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
813  { 102, sizeof((table).q060), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
814  { 102, sizeof((table).q061), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
815  { 102, sizeof((table).q062), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
816  { 102, sizeof((table).q063), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
817  { 102, sizeof((table).q064), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
818  { 102, sizeof((table).q065), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
819  { 102, sizeof((table).q066), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
820  { 102, sizeof((table).q067), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
821  { 102, sizeof((table).q068), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
822  { 102, sizeof((table).q069), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
823  { 102, sizeof((table).q070), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
824  { 102, sizeof((table).q071), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
825  { 102, sizeof((table).q072), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
826  { 102, sizeof((table).q073), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
827  { 102, sizeof((table).q074), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
828  { 102, sizeof((table).q075), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
829  { 102, sizeof((table).q076), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
830  { 102, sizeof((table).q077), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
831  { 102, sizeof((table).q078), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
832  { 102, sizeof((table).q079), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
833  { 102, sizeof((table).q080), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
834  { 102, sizeof((table).q081), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
835  { 102, sizeof((table).q082), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
836  { 102, sizeof((table).q083), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
837  { 102, sizeof((table).q084), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
838  { 102, sizeof((table).q085), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
839  { 102, sizeof((table).q086), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
840  { 102, sizeof((table).q087), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
841  { 102, sizeof((table).q088), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
842  { 102, sizeof((table).q089), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
843  { 102, sizeof((table).q090), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
844  { 102, sizeof((table).q091), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
845  { 102, sizeof((table).q092), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
846  { 102, sizeof((table).q093), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
847  { 102, sizeof((table).q094), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
848  { 102, sizeof((table).q095), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
849  { 102, sizeof((table).q096), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
850  { 102, sizeof((table).q097), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
851  { 102, sizeof((table).q098), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
852  { 102, sizeof((table).q099), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
853  { 102, sizeof((table).q100), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
854 #line 374 "rat.ec"
855  };
856  static ifx_sqlda_t _SD0 = { 218, _sqobind, {0}, 218, 0 };
857  static _FetchSpec _FS1 = { 0, 1, 0 };
858 #line 374 "rat.ec"
859  _sqobind[0].sqldata = (table).id;
860 #line 374 "rat.ec"
861  _sqobind[1].sqldata = (table).pe1;
862 #line 374 "rat.ec"
863  _sqobind[2].sqldata = (table).pe2;
864 #line 374 "rat.ec"
865  _sqobind[3].sqldata = (char *) &(table).tbl;
866 #line 374 "rat.ec"
867  _sqobind[4].sqldata = (char *) &(table).valid_date;
868 #line 374 "rat.ec"
869  _sqobind[5].sqldata = (char *) &(table).gs;
870 #line 374 "rat.ec"
871  _sqobind[6].sqldata = (char *) &(table).src;
872 #line 374 "rat.ec"
873  _sqobind[7].sqldata = (char *) &(table).fix;
874 #line 374 "rat.ec"
875  _sqobind[8].sqldata = (char *) &(table).datacol;
876 #line 374 "rat.ec"
877  _sqobind[9].sqldata = (char *) &(table).ver5;
878 #line 374 "rat.ec"
879  _sqobind[10].sqldata = (char *) &(table).fld;
880 #line 374 "rat.ec"
881  _sqobind[11].sqldata = (char *) &(table).wrn;
882 #line 374 "rat.ec"
883  _sqobind[12].sqldata = (char *) &(table).hist_stg;
884 #line 374 "rat.ec"
885  _sqobind[13].sqldata = (char *) &(table).hist_q;
886 #line 374 "rat.ec"
887  _sqobind[14].sqldata = (char *) &(table).hist_date;
888 #line 374 "rat.ec"
889  _sqobind[15].sqldata = (char *) &(table).spil;
890 #line 374 "rat.ec"
891  _sqobind[16].sqldata = (char *) &(table).ded;
892 #line 374 "rat.ec"
893  _sqobind[17].sqldata = (char *) &(table).cap;
894 #line 374 "rat.ec"
895  _sqobind[18].sqldata = (char *) &(table).stg001;
896 #line 374 "rat.ec"
897  _sqobind[19].sqldata = (char *) &(table).stg002;
898 #line 374 "rat.ec"
899  _sqobind[20].sqldata = (char *) &(table).stg003;
900 #line 374 "rat.ec"
901  _sqobind[21].sqldata = (char *) &(table).stg004;
902 #line 374 "rat.ec"
903  _sqobind[22].sqldata = (char *) &(table).stg005;
904 #line 374 "rat.ec"
905  _sqobind[23].sqldata = (char *) &(table).stg006;
906 #line 374 "rat.ec"
907  _sqobind[24].sqldata = (char *) &(table).stg007;
908 #line 374 "rat.ec"
909  _sqobind[25].sqldata = (char *) &(table).stg008;
910 #line 374 "rat.ec"
911  _sqobind[26].sqldata = (char *) &(table).stg009;
912 #line 374 "rat.ec"
913  _sqobind[27].sqldata = (char *) &(table).stg010;
914 #line 374 "rat.ec"
915  _sqobind[28].sqldata = (char *) &(table).stg011;
916 #line 374 "rat.ec"
917  _sqobind[29].sqldata = (char *) &(table).stg012;
918 #line 374 "rat.ec"
919  _sqobind[30].sqldata = (char *) &(table).stg013;
920 #line 374 "rat.ec"
921  _sqobind[31].sqldata = (char *) &(table).stg014;
922 #line 374 "rat.ec"
923  _sqobind[32].sqldata = (char *) &(table).stg015;
924 #line 374 "rat.ec"
925  _sqobind[33].sqldata = (char *) &(table).stg016;
926 #line 374 "rat.ec"
927  _sqobind[34].sqldata = (char *) &(table).stg017;
928 #line 374 "rat.ec"
929  _sqobind[35].sqldata = (char *) &(table).stg018;
930 #line 374 "rat.ec"
931  _sqobind[36].sqldata = (char *) &(table).stg019;
932 #line 374 "rat.ec"
933  _sqobind[37].sqldata = (char *) &(table).stg020;
934 #line 374 "rat.ec"
935  _sqobind[38].sqldata = (char *) &(table).stg021;
936 #line 374 "rat.ec"
937  _sqobind[39].sqldata = (char *) &(table).stg022;
938 #line 374 "rat.ec"
939  _sqobind[40].sqldata = (char *) &(table).stg023;
940 #line 374 "rat.ec"
941  _sqobind[41].sqldata = (char *) &(table).stg024;
942 #line 374 "rat.ec"
943  _sqobind[42].sqldata = (char *) &(table).stg025;
944 #line 374 "rat.ec"
945  _sqobind[43].sqldata = (char *) &(table).stg026;
946 #line 374 "rat.ec"
947  _sqobind[44].sqldata = (char *) &(table).stg027;
948 #line 374 "rat.ec"
949  _sqobind[45].sqldata = (char *) &(table).stg028;
950 #line 374 "rat.ec"
951  _sqobind[46].sqldata = (char *) &(table).stg029;
952 #line 374 "rat.ec"
953  _sqobind[47].sqldata = (char *) &(table).stg030;
954 #line 374 "rat.ec"
955  _sqobind[48].sqldata = (char *) &(table).stg031;
956 #line 374 "rat.ec"
957  _sqobind[49].sqldata = (char *) &(table).stg032;
958 #line 374 "rat.ec"
959  _sqobind[50].sqldata = (char *) &(table).stg033;
960 #line 374 "rat.ec"
961  _sqobind[51].sqldata = (char *) &(table).stg034;
962 #line 374 "rat.ec"
963  _sqobind[52].sqldata = (char *) &(table).stg035;
964 #line 374 "rat.ec"
965  _sqobind[53].sqldata = (char *) &(table).stg036;
966 #line 374 "rat.ec"
967  _sqobind[54].sqldata = (char *) &(table).stg037;
968 #line 374 "rat.ec"
969  _sqobind[55].sqldata = (char *) &(table).stg038;
970 #line 374 "rat.ec"
971  _sqobind[56].sqldata = (char *) &(table).stg039;
972 #line 374 "rat.ec"
973  _sqobind[57].sqldata = (char *) &(table).stg040;
974 #line 374 "rat.ec"
975  _sqobind[58].sqldata = (char *) &(table).stg041;
976 #line 374 "rat.ec"
977  _sqobind[59].sqldata = (char *) &(table).stg042;
978 #line 374 "rat.ec"
979  _sqobind[60].sqldata = (char *) &(table).stg043;
980 #line 374 "rat.ec"
981  _sqobind[61].sqldata = (char *) &(table).stg044;
982 #line 374 "rat.ec"
983  _sqobind[62].sqldata = (char *) &(table).stg045;
984 #line 374 "rat.ec"
985  _sqobind[63].sqldata = (char *) &(table).stg046;
986 #line 374 "rat.ec"
987  _sqobind[64].sqldata = (char *) &(table).stg047;
988 #line 374 "rat.ec"
989  _sqobind[65].sqldata = (char *) &(table).stg048;
990 #line 374 "rat.ec"
991  _sqobind[66].sqldata = (char *) &(table).stg049;
992 #line 374 "rat.ec"
993  _sqobind[67].sqldata = (char *) &(table).stg050;
994 #line 374 "rat.ec"
995  _sqobind[68].sqldata = (char *) &(table).stg051;
996 #line 374 "rat.ec"
997  _sqobind[69].sqldata = (char *) &(table).stg052;
998 #line 374 "rat.ec"
999  _sqobind[70].sqldata = (char *) &(table).stg053;
1000 #line 374 "rat.ec"
1001  _sqobind[71].sqldata = (char *) &(table).stg054;
1002 #line 374 "rat.ec"
1003  _sqobind[72].sqldata = (char *) &(table).stg055;
1004 #line 374 "rat.ec"
1005  _sqobind[73].sqldata = (char *) &(table).stg056;
1006 #line 374 "rat.ec"
1007  _sqobind[74].sqldata = (char *) &(table).stg057;
1008 #line 374 "rat.ec"
1009  _sqobind[75].sqldata = (char *) &(table).stg058;
1010 #line 374 "rat.ec"
1011  _sqobind[76].sqldata = (char *) &(table).stg059;
1012 #line 374 "rat.ec"
1013  _sqobind[77].sqldata = (char *) &(table).stg060;
1014 #line 374 "rat.ec"
1015  _sqobind[78].sqldata = (char *) &(table).stg061;
1016 #line 374 "rat.ec"
1017  _sqobind[79].sqldata = (char *) &(table).stg062;
1018 #line 374 "rat.ec"
1019  _sqobind[80].sqldata = (char *) &(table).stg063;
1020 #line 374 "rat.ec"
1021  _sqobind[81].sqldata = (char *) &(table).stg064;
1022 #line 374 "rat.ec"
1023  _sqobind[82].sqldata = (char *) &(table).stg065;
1024 #line 374 "rat.ec"
1025  _sqobind[83].sqldata = (char *) &(table).stg066;
1026 #line 374 "rat.ec"
1027  _sqobind[84].sqldata = (char *) &(table).stg067;
1028 #line 374 "rat.ec"
1029  _sqobind[85].sqldata = (char *) &(table).stg068;
1030 #line 374 "rat.ec"
1031  _sqobind[86].sqldata = (char *) &(table).stg069;
1032 #line 374 "rat.ec"
1033  _sqobind[87].sqldata = (char *) &(table).stg070;
1034 #line 374 "rat.ec"
1035  _sqobind[88].sqldata = (char *) &(table).stg071;
1036 #line 374 "rat.ec"
1037  _sqobind[89].sqldata = (char *) &(table).stg072;
1038 #line 374 "rat.ec"
1039  _sqobind[90].sqldata = (char *) &(table).stg073;
1040 #line 374 "rat.ec"
1041  _sqobind[91].sqldata = (char *) &(table).stg074;
1042 #line 374 "rat.ec"
1043  _sqobind[92].sqldata = (char *) &(table).stg075;
1044 #line 374 "rat.ec"
1045  _sqobind[93].sqldata = (char *) &(table).stg076;
1046 #line 374 "rat.ec"
1047  _sqobind[94].sqldata = (char *) &(table).stg077;
1048 #line 374 "rat.ec"
1049  _sqobind[95].sqldata = (char *) &(table).stg078;
1050 #line 374 "rat.ec"
1051  _sqobind[96].sqldata = (char *) &(table).stg079;
1052 #line 374 "rat.ec"
1053  _sqobind[97].sqldata = (char *) &(table).stg080;
1054 #line 374 "rat.ec"
1055  _sqobind[98].sqldata = (char *) &(table).stg081;
1056 #line 374 "rat.ec"
1057  _sqobind[99].sqldata = (char *) &(table).stg082;
1058 #line 374 "rat.ec"
1059  _sqobind[100].sqldata = (char *) &(table).stg083;
1060 #line 374 "rat.ec"
1061  _sqobind[101].sqldata = (char *) &(table).stg084;
1062 #line 374 "rat.ec"
1063  _sqobind[102].sqldata = (char *) &(table).stg085;
1064 #line 374 "rat.ec"
1065  _sqobind[103].sqldata = (char *) &(table).stg086;
1066 #line 374 "rat.ec"
1067  _sqobind[104].sqldata = (char *) &(table).stg087;
1068 #line 374 "rat.ec"
1069  _sqobind[105].sqldata = (char *) &(table).stg088;
1070 #line 374 "rat.ec"
1071  _sqobind[106].sqldata = (char *) &(table).stg089;
1072 #line 374 "rat.ec"
1073  _sqobind[107].sqldata = (char *) &(table).stg090;
1074 #line 374 "rat.ec"
1075  _sqobind[108].sqldata = (char *) &(table).stg091;
1076 #line 374 "rat.ec"
1077  _sqobind[109].sqldata = (char *) &(table).stg092;
1078 #line 374 "rat.ec"
1079  _sqobind[110].sqldata = (char *) &(table).stg093;
1080 #line 374 "rat.ec"
1081  _sqobind[111].sqldata = (char *) &(table).stg094;
1082 #line 374 "rat.ec"
1083  _sqobind[112].sqldata = (char *) &(table).stg095;
1084 #line 374 "rat.ec"
1085  _sqobind[113].sqldata = (char *) &(table).stg096;
1086 #line 374 "rat.ec"
1087  _sqobind[114].sqldata = (char *) &(table).stg097;
1088 #line 374 "rat.ec"
1089  _sqobind[115].sqldata = (char *) &(table).stg098;
1090 #line 374 "rat.ec"
1091  _sqobind[116].sqldata = (char *) &(table).stg099;
1092 #line 374 "rat.ec"
1093  _sqobind[117].sqldata = (char *) &(table).stg100;
1094 #line 374 "rat.ec"
1095  _sqobind[118].sqldata = (char *) &(table).q001;
1096 #line 374 "rat.ec"
1097  _sqobind[119].sqldata = (char *) &(table).q002;
1098 #line 374 "rat.ec"
1099  _sqobind[120].sqldata = (char *) &(table).q003;
1100 #line 374 "rat.ec"
1101  _sqobind[121].sqldata = (char *) &(table).q004;
1102 #line 374 "rat.ec"
1103  _sqobind[122].sqldata = (char *) &(table).q005;
1104 #line 374 "rat.ec"
1105  _sqobind[123].sqldata = (char *) &(table).q006;
1106 #line 374 "rat.ec"
1107  _sqobind[124].sqldata = (char *) &(table).q007;
1108 #line 374 "rat.ec"
1109  _sqobind[125].sqldata = (char *) &(table).q008;
1110 #line 374 "rat.ec"
1111  _sqobind[126].sqldata = (char *) &(table).q009;
1112 #line 374 "rat.ec"
1113  _sqobind[127].sqldata = (char *) &(table).q010;
1114 #line 374 "rat.ec"
1115  _sqobind[128].sqldata = (char *) &(table).q011;
1116 #line 374 "rat.ec"
1117  _sqobind[129].sqldata = (char *) &(table).q012;
1118 #line 374 "rat.ec"
1119  _sqobind[130].sqldata = (char *) &(table).q013;
1120 #line 374 "rat.ec"
1121  _sqobind[131].sqldata = (char *) &(table).q014;
1122 #line 374 "rat.ec"
1123  _sqobind[132].sqldata = (char *) &(table).q015;
1124 #line 374 "rat.ec"
1125  _sqobind[133].sqldata = (char *) &(table).q016;
1126 #line 374 "rat.ec"
1127  _sqobind[134].sqldata = (char *) &(table).q017;
1128 #line 374 "rat.ec"
1129  _sqobind[135].sqldata = (char *) &(table).q018;
1130 #line 374 "rat.ec"
1131  _sqobind[136].sqldata = (char *) &(table).q019;
1132 #line 374 "rat.ec"
1133  _sqobind[137].sqldata = (char *) &(table).q020;
1134 #line 374 "rat.ec"
1135  _sqobind[138].sqldata = (char *) &(table).q021;
1136 #line 374 "rat.ec"
1137  _sqobind[139].sqldata = (char *) &(table).q022;
1138 #line 374 "rat.ec"
1139  _sqobind[140].sqldata = (char *) &(table).q023;
1140 #line 374 "rat.ec"
1141  _sqobind[141].sqldata = (char *) &(table).q024;
1142 #line 374 "rat.ec"
1143  _sqobind[142].sqldata = (char *) &(table).q025;
1144 #line 374 "rat.ec"
1145  _sqobind[143].sqldata = (char *) &(table).q026;
1146 #line 374 "rat.ec"
1147  _sqobind[144].sqldata = (char *) &(table).q027;
1148 #line 374 "rat.ec"
1149  _sqobind[145].sqldata = (char *) &(table).q028;
1150 #line 374 "rat.ec"
1151  _sqobind[146].sqldata = (char *) &(table).q029;
1152 #line 374 "rat.ec"
1153  _sqobind[147].sqldata = (char *) &(table).q030;
1154 #line 374 "rat.ec"
1155  _sqobind[148].sqldata = (char *) &(table).q031;
1156 #line 374 "rat.ec"
1157  _sqobind[149].sqldata = (char *) &(table).q032;
1158 #line 374 "rat.ec"
1159  _sqobind[150].sqldata = (char *) &(table).q033;
1160 #line 374 "rat.ec"
1161  _sqobind[151].sqldata = (char *) &(table).q034;
1162 #line 374 "rat.ec"
1163  _sqobind[152].sqldata = (char *) &(table).q035;
1164 #line 374 "rat.ec"
1165  _sqobind[153].sqldata = (char *) &(table).q036;
1166 #line 374 "rat.ec"
1167  _sqobind[154].sqldata = (char *) &(table).q037;
1168 #line 374 "rat.ec"
1169  _sqobind[155].sqldata = (char *) &(table).q038;
1170 #line 374 "rat.ec"
1171  _sqobind[156].sqldata = (char *) &(table).q039;
1172 #line 374 "rat.ec"
1173  _sqobind[157].sqldata = (char *) &(table).q040;
1174 #line 374 "rat.ec"
1175  _sqobind[158].sqldata = (char *) &(table).q041;
1176 #line 374 "rat.ec"
1177  _sqobind[159].sqldata = (char *) &(table).q042;
1178 #line 374 "rat.ec"
1179  _sqobind[160].sqldata = (char *) &(table).q043;
1180 #line 374 "rat.ec"
1181  _sqobind[161].sqldata = (char *) &(table).q044;
1182 #line 374 "rat.ec"
1183  _sqobind[162].sqldata = (char *) &(table).q045;
1184 #line 374 "rat.ec"
1185  _sqobind[163].sqldata = (char *) &(table).q046;
1186 #line 374 "rat.ec"
1187  _sqobind[164].sqldata = (char *) &(table).q047;
1188 #line 374 "rat.ec"
1189  _sqobind[165].sqldata = (char *) &(table).q048;
1190 #line 374 "rat.ec"
1191  _sqobind[166].sqldata = (char *) &(table).q049;
1192 #line 374 "rat.ec"
1193  _sqobind[167].sqldata = (char *) &(table).q050;
1194 #line 374 "rat.ec"
1195  _sqobind[168].sqldata = (char *) &(table).q051;
1196 #line 374 "rat.ec"
1197  _sqobind[169].sqldata = (char *) &(table).q052;
1198 #line 374 "rat.ec"
1199  _sqobind[170].sqldata = (char *) &(table).q053;
1200 #line 374 "rat.ec"
1201  _sqobind[171].sqldata = (char *) &(table).q054;
1202 #line 374 "rat.ec"
1203  _sqobind[172].sqldata = (char *) &(table).q055;
1204 #line 374 "rat.ec"
1205  _sqobind[173].sqldata = (char *) &(table).q056;
1206 #line 374 "rat.ec"
1207  _sqobind[174].sqldata = (char *) &(table).q057;
1208 #line 374 "rat.ec"
1209  _sqobind[175].sqldata = (char *) &(table).q058;
1210 #line 374 "rat.ec"
1211  _sqobind[176].sqldata = (char *) &(table).q059;
1212 #line 374 "rat.ec"
1213  _sqobind[177].sqldata = (char *) &(table).q060;
1214 #line 374 "rat.ec"
1215  _sqobind[178].sqldata = (char *) &(table).q061;
1216 #line 374 "rat.ec"
1217  _sqobind[179].sqldata = (char *) &(table).q062;
1218 #line 374 "rat.ec"
1219  _sqobind[180].sqldata = (char *) &(table).q063;
1220 #line 374 "rat.ec"
1221  _sqobind[181].sqldata = (char *) &(table).q064;
1222 #line 374 "rat.ec"
1223  _sqobind[182].sqldata = (char *) &(table).q065;
1224 #line 374 "rat.ec"
1225  _sqobind[183].sqldata = (char *) &(table).q066;
1226 #line 374 "rat.ec"
1227  _sqobind[184].sqldata = (char *) &(table).q067;
1228 #line 374 "rat.ec"
1229  _sqobind[185].sqldata = (char *) &(table).q068;
1230 #line 374 "rat.ec"
1231  _sqobind[186].sqldata = (char *) &(table).q069;
1232 #line 374 "rat.ec"
1233  _sqobind[187].sqldata = (char *) &(table).q070;
1234 #line 374 "rat.ec"
1235  _sqobind[188].sqldata = (char *) &(table).q071;
1236 #line 374 "rat.ec"
1237  _sqobind[189].sqldata = (char *) &(table).q072;
1238 #line 374 "rat.ec"
1239  _sqobind[190].sqldata = (char *) &(table).q073;
1240 #line 374 "rat.ec"
1241  _sqobind[191].sqldata = (char *) &(table).q074;
1242 #line 374 "rat.ec"
1243  _sqobind[192].sqldata = (char *) &(table).q075;
1244 #line 374 "rat.ec"
1245  _sqobind[193].sqldata = (char *) &(table).q076;
1246 #line 374 "rat.ec"
1247  _sqobind[194].sqldata = (char *) &(table).q077;
1248 #line 374 "rat.ec"
1249  _sqobind[195].sqldata = (char *) &(table).q078;
1250 #line 374 "rat.ec"
1251  _sqobind[196].sqldata = (char *) &(table).q079;
1252 #line 374 "rat.ec"
1253  _sqobind[197].sqldata = (char *) &(table).q080;
1254 #line 374 "rat.ec"
1255  _sqobind[198].sqldata = (char *) &(table).q081;
1256 #line 374 "rat.ec"
1257  _sqobind[199].sqldata = (char *) &(table).q082;
1258 #line 374 "rat.ec"
1259  _sqobind[200].sqldata = (char *) &(table).q083;
1260 #line 374 "rat.ec"
1261  _sqobind[201].sqldata = (char *) &(table).q084;
1262 #line 374 "rat.ec"
1263  _sqobind[202].sqldata = (char *) &(table).q085;
1264 #line 374 "rat.ec"
1265  _sqobind[203].sqldata = (char *) &(table).q086;
1266 #line 374 "rat.ec"
1267  _sqobind[204].sqldata = (char *) &(table).q087;
1268 #line 374 "rat.ec"
1269  _sqobind[205].sqldata = (char *) &(table).q088;
1270 #line 374 "rat.ec"
1271  _sqobind[206].sqldata = (char *) &(table).q089;
1272 #line 374 "rat.ec"
1273  _sqobind[207].sqldata = (char *) &(table).q090;
1274 #line 374 "rat.ec"
1275  _sqobind[208].sqldata = (char *) &(table).q091;
1276 #line 374 "rat.ec"
1277  _sqobind[209].sqldata = (char *) &(table).q092;
1278 #line 374 "rat.ec"
1279  _sqobind[210].sqldata = (char *) &(table).q093;
1280 #line 374 "rat.ec"
1281  _sqobind[211].sqldata = (char *) &(table).q094;
1282 #line 374 "rat.ec"
1283  _sqobind[212].sqldata = (char *) &(table).q095;
1284 #line 374 "rat.ec"
1285  _sqobind[213].sqldata = (char *) &(table).q096;
1286 #line 374 "rat.ec"
1287  _sqobind[214].sqldata = (char *) &(table).q097;
1288 #line 374 "rat.ec"
1289  _sqobind[215].sqldata = (char *) &(table).q098;
1290 #line 374 "rat.ec"
1291  _sqobind[216].sqldata = (char *) &(table).q099;
1292 #line 374 "rat.ec"
1293  _sqobind[217].sqldata = (char *) &(table).q100;
1294  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn2, 768), (ifx_sqlda_t *)0, &_SD0, (char *)0, &_FS1);
1295 #line 374 "rat.ec"
1296  }
1297 
1298 if(sqlca.sqlcode < 0)
1299  return(sqlca.sqlcode);
1300 
1301 if(sqlca.sqlcode == 100)
1302  return(-1);
1303 
1304 /*
1305  * EXEC SQL close ratecursor;
1306  */
1307 #line 382 "rat.ec"
1308  {
1309 #line 382 "rat.ec"
1310  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn2, 768));
1311 #line 382 "rat.ec"
1312  }
1313 
1314 rate_table.RatStg[0] = table.stg001;
1315 rate_table.RatStg[1] = table.stg002;
1316 rate_table.RatStg[2] = table.stg003;
1317 rate_table.RatStg[3] = table.stg004;
1318 rate_table.RatStg[4] = table.stg005;
1319 rate_table.RatStg[5] = table.stg006;
1320 rate_table.RatStg[6] = table.stg007;
1321 rate_table.RatStg[7] = table.stg008;
1322 rate_table.RatStg[8] = table.stg009;
1323 rate_table.RatStg[9] = table.stg010;
1324 rate_table.RatStg[10] = table.stg011;
1325 rate_table.RatStg[11] = table.stg012;
1326 rate_table.RatStg[12] = table.stg013;
1327 rate_table.RatStg[13] = table.stg014;
1328 rate_table.RatStg[14] = table.stg015;
1329 rate_table.RatStg[15] = table.stg016;
1330 rate_table.RatStg[16] = table.stg017;
1331 rate_table.RatStg[17] = table.stg018;
1332 rate_table.RatStg[18] = table.stg019;
1333 rate_table.RatStg[19] = table.stg020;
1334 rate_table.RatStg[20] = table.stg021;
1335 rate_table.RatStg[21] = table.stg022;
1336 rate_table.RatStg[22] = table.stg023;
1337 rate_table.RatStg[23] = table.stg024;
1338 rate_table.RatStg[24] = table.stg025;
1339 rate_table.RatStg[25] = table.stg026;
1340 rate_table.RatStg[26] = table.stg027;
1341 rate_table.RatStg[27] = table.stg028;
1342 rate_table.RatStg[28] = table.stg029;
1343 rate_table.RatStg[29] = table.stg030;
1344 rate_table.RatStg[30] = table.stg031;
1345 rate_table.RatStg[31] = table.stg032;
1346 rate_table.RatStg[32] = table.stg033;
1347 rate_table.RatStg[33] = table.stg034;
1348 rate_table.RatStg[34] = table.stg035;
1349 rate_table.RatStg[35] = table.stg036;
1350 rate_table.RatStg[36] = table.stg037;
1351 rate_table.RatStg[37] = table.stg038;
1352 rate_table.RatStg[38] = table.stg039;
1353 rate_table.RatStg[39] = table.stg040;
1354 rate_table.RatStg[40] = table.stg041;
1355 rate_table.RatStg[41] = table.stg042;
1356 rate_table.RatStg[42] = table.stg043;
1357 rate_table.RatStg[43] = table.stg044;
1358 rate_table.RatStg[44] = table.stg045;
1359 rate_table.RatStg[45] = table.stg046;
1360 rate_table.RatStg[46] = table.stg047;
1361 rate_table.RatStg[47] = table.stg048;
1362 rate_table.RatStg[48] = table.stg049;
1363 rate_table.RatStg[49] = table.stg050;
1364 rate_table.RatStg[50] = table.stg051;
1365 rate_table.RatStg[51] = table.stg052;
1366 rate_table.RatStg[52] = table.stg053;
1367 rate_table.RatStg[53] = table.stg054;
1368 rate_table.RatStg[54] = table.stg055;
1369 rate_table.RatStg[55] = table.stg056;
1370 rate_table.RatStg[56] = table.stg057;
1371 rate_table.RatStg[57] = table.stg058;
1372 rate_table.RatStg[58] = table.stg059;
1373 rate_table.RatStg[59] = table.stg060;
1374 rate_table.RatStg[60] = table.stg061;
1375 rate_table.RatStg[61] = table.stg062;
1376 rate_table.RatStg[62] = table.stg063;
1377 rate_table.RatStg[63] = table.stg064;
1378 rate_table.RatStg[64] = table.stg065;
1379 rate_table.RatStg[65] = table.stg066;
1380 rate_table.RatStg[66] = table.stg067;
1381 rate_table.RatStg[67] = table.stg068;
1382 rate_table.RatStg[68] = table.stg069;
1383 rate_table.RatStg[69] = table.stg070;
1384 rate_table.RatStg[70] = table.stg071;
1385 rate_table.RatStg[71] = table.stg072;
1386 rate_table.RatStg[72] = table.stg073;
1387 rate_table.RatStg[73] = table.stg074;
1388 rate_table.RatStg[74] = table.stg075;
1389 rate_table.RatStg[75] = table.stg076;
1390 rate_table.RatStg[76] = table.stg077;
1391 rate_table.RatStg[77] = table.stg078;
1392 rate_table.RatStg[78] = table.stg079;
1393 rate_table.RatStg[79] = table.stg080;
1394 rate_table.RatStg[80] = table.stg081;
1395 rate_table.RatStg[81] = table.stg082;
1396 rate_table.RatStg[82] = table.stg083;
1397 rate_table.RatStg[83] = table.stg084;
1398 rate_table.RatStg[84] = table.stg085;
1399 rate_table.RatStg[85] = table.stg086;
1400 rate_table.RatStg[86] = table.stg087;
1401 rate_table.RatStg[87] = table.stg088;
1402 rate_table.RatStg[88] = table.stg089;
1403 rate_table.RatStg[89] = table.stg090;
1404 rate_table.RatStg[90] = table.stg091;
1405 rate_table.RatStg[91] = table.stg092;
1406 rate_table.RatStg[92] = table.stg093;
1407 rate_table.RatStg[93] = table.stg094;
1408 rate_table.RatStg[94] = table.stg095;
1409 rate_table.RatStg[95] = table.stg096;
1410 rate_table.RatStg[96] = table.stg097;
1411 rate_table.RatStg[97] = table.stg098;
1412 rate_table.RatStg[98] = table.stg099;
1413 rate_table.RatStg[99] = table.stg100;
1414 
1415 rate_table.RatQ[0] = table.q001;
1416 rate_table.RatQ[1] = table.q002;
1417 rate_table.RatQ[2] = table.q003;
1418 rate_table.RatQ[3] = table.q004;
1419 rate_table.RatQ[4] = table.q005;
1420 rate_table.RatQ[5] = table.q006;
1421 rate_table.RatQ[6] = table.q007;
1422 rate_table.RatQ[7] = table.q008;
1423 rate_table.RatQ[8] = table.q009;
1424 rate_table.RatQ[9] = table.q010;
1425 rate_table.RatQ[10] = table.q011;
1426 rate_table.RatQ[11] = table.q012;
1427 rate_table.RatQ[12] = table.q013;
1428 rate_table.RatQ[13] = table.q014;
1429 rate_table.RatQ[14] = table.q015;
1430 rate_table.RatQ[15] = table.q016;
1431 rate_table.RatQ[16] = table.q017;
1432 rate_table.RatQ[17] = table.q018;
1433 rate_table.RatQ[18] = table.q019;
1434 rate_table.RatQ[19] = table.q020;
1435 rate_table.RatQ[20] = table.q021;
1436 rate_table.RatQ[21] = table.q022;
1437 rate_table.RatQ[22] = table.q023;
1438 rate_table.RatQ[23] = table.q024;
1439 rate_table.RatQ[24] = table.q025;
1440 rate_table.RatQ[25] = table.q026;
1441 rate_table.RatQ[26] = table.q027;
1442 rate_table.RatQ[27] = table.q028;
1443 rate_table.RatQ[28] = table.q029;
1444 rate_table.RatQ[29] = table.q030;
1445 rate_table.RatQ[30] = table.q031;
1446 rate_table.RatQ[31] = table.q032;
1447 rate_table.RatQ[32] = table.q033;
1448 rate_table.RatQ[33] = table.q034;
1449 rate_table.RatQ[34] = table.q035;
1450 rate_table.RatQ[35] = table.q036;
1451 rate_table.RatQ[36] = table.q037;
1452 rate_table.RatQ[37] = table.q038;
1453 rate_table.RatQ[38] = table.q039;
1454 rate_table.RatQ[39] = table.q040;
1455 rate_table.RatQ[40] = table.q041;
1456 rate_table.RatQ[41] = table.q042;
1457 rate_table.RatQ[42] = table.q043;
1458 rate_table.RatQ[43] = table.q044;
1459 rate_table.RatQ[44] = table.q045;
1460 rate_table.RatQ[45] = table.q046;
1461 rate_table.RatQ[46] = table.q047;
1462 rate_table.RatQ[47] = table.q048;
1463 rate_table.RatQ[48] = table.q049;
1464 rate_table.RatQ[49] = table.q050;
1465 rate_table.RatQ[50] = table.q051;
1466 rate_table.RatQ[51] = table.q052;
1467 rate_table.RatQ[52] = table.q053;
1468 rate_table.RatQ[53] = table.q054;
1469 rate_table.RatQ[54] = table.q055;
1470 rate_table.RatQ[55] = table.q056;
1471 rate_table.RatQ[56] = table.q057;
1472 rate_table.RatQ[57] = table.q058;
1473 rate_table.RatQ[58] = table.q059;
1474 rate_table.RatQ[59] = table.q060;
1475 rate_table.RatQ[60] = table.q061;
1476 rate_table.RatQ[61] = table.q062;
1477 rate_table.RatQ[62] = table.q063;
1478 rate_table.RatQ[63] = table.q064;
1479 rate_table.RatQ[64] = table.q065;
1480 rate_table.RatQ[65] = table.q066;
1481 rate_table.RatQ[66] = table.q067;
1482 rate_table.RatQ[67] = table.q068;
1483 rate_table.RatQ[68] = table.q069;
1484 rate_table.RatQ[69] = table.q070;
1485 rate_table.RatQ[70] = table.q071;
1486 rate_table.RatQ[71] = table.q072;
1487 rate_table.RatQ[72] = table.q073;
1488 rate_table.RatQ[73] = table.q074;
1489 rate_table.RatQ[74] = table.q075;
1490 rate_table.RatQ[75] = table.q076;
1491 rate_table.RatQ[76] = table.q077;
1492 rate_table.RatQ[77] = table.q078;
1493 rate_table.RatQ[78] = table.q079;
1494 rate_table.RatQ[79] = table.q080;
1495 rate_table.RatQ[80] = table.q081;
1496 rate_table.RatQ[81] = table.q082;
1497 rate_table.RatQ[82] = table.q083;
1498 rate_table.RatQ[83] = table.q084;
1499 rate_table.RatQ[84] = table.q085;
1500 rate_table.RatQ[85] = table.q086;
1501 rate_table.RatQ[86] = table.q087;
1502 rate_table.RatQ[87] = table.q088;
1503 rate_table.RatQ[88] = table.q089;
1504 rate_table.RatQ[89] = table.q090;
1505 rate_table.RatQ[90] = table.q091;
1506 rate_table.RatQ[91] = table.q092;
1507 rate_table.RatQ[92] = table.q093;
1508 rate_table.RatQ[93] = table.q094;
1509 rate_table.RatQ[94] = table.q095;
1510 rate_table.RatQ[95] = table.q096;
1511 rate_table.RatQ[96] = table.q097;
1512 rate_table.RatQ[97] = table.q098;
1513 rate_table.RatQ[98] = table.q099;
1514 rate_table.RatQ[99] = table.q100;
1515 
1516 /* if all flows are zero, will get huge negative numbers when
1517  calling GetFlow. So return an error of -2 */
1518 
1519  for(i = 0; i <100; i++)
1520  {
1521  if(rate_table.RatQ[i] == 0)
1522  zero_flow++;
1523  }
1524 
1525  if(zero_flow == 100){
1526  return(-2);
1527  zero_flow = 0;}
1528 
1529 rate_table.hist_stg = table.hist_stg;
1530 rate_table.hist_q = table.hist_q;
1531 rate_table.hist_date = table.hist_date;
1532 rate_table.ver5 = table.ver5;
1533 rate_table.wrn = table.wrn;
1534 rate_table.fld = table.fld;
1535 
1538 
1539 for(i = 0; i < 100; i++)
1540 {
1541  if((rate_table.RatStg[i] == 0.00) && (i != 0))
1542  {
1544  rate_table.QMax = rate_table.RatQ[i-1];
1545  rate_table.AryMax = i;
1546  break;
1547  }
1548 }
1549 
1550 if(i==100)
1551 {
1553  rate_table.QMax = rate_table.RatQ[i-1];
1554  rate_table.AryMax = i;
1555 
1556 }
1557 
1558 
1559 j=0;
1560 for(i=0;i<=rate_table.AryMax;i++) {
1561 
1562  if(i!=0) {
1563 
1564  if(rate_table.RatStg[j] == rate_table.RatStg[i] ||
1565  rate_table.RatQ[j] == rate_table.RatQ[i]) {
1566 
1567  continue;
1568  }
1569  j++;
1571  rate_table.RatQ[j] = rate_table.RatQ[i];
1572 
1573 
1574  }
1575 
1576  }
1577 
1578 rate_table.AryMax=j;
1579 
1580 if(rate_table.AryMax == 1)
1581 {
1582  printf("\n**ERROR: Only one pair of (stage,flow)values**\n");
1583  return (-1);
1584 }
1585 
1586 /* calculate slope, flow(y axis) intercept and stage(x axis) intercept*/
1587 
1590 if(Slope==0)
1591  Slope=.01;
1592 
1594 
1595 stg_int = -(b/Slope);
1596 
1597 /*check to see which pair is zero(end of shifts) & rename the pairs in
1598 shift table accordingly--or if there are no shifts*/
1599 
1600  if((rate_table.Shift.Val[0]==0)&&(rate_table.Shift.Sh[0]==0)&&
1601  (rate_table.Shift.Val[1]==0))
1602  {
1603  Val[0]=rate_table.Shift.Val[0];
1604  Sh[0]=rate_table.Shift.Val[0];
1605  Val[1]=rate_table.Shift.Val[1];
1606  Sh[1]=rate_table.Shift.Val[1];
1607  Val[2]=rate_table.Shift.Val[2];
1608  Sh[2]=rate_table.Shift.Val[2];
1609  Val[3]=rate_table.Shift.Val[3];
1610  Sh[3]=rate_table.Shift.Val[3];
1611  j=0;
1612  }
1613 
1614  else
1615  {
1616  j=0;
1617  for(i = 0; i < 4; i++)
1618  {
1619 
1620  if(rate_table.Shift.Val[i] != 0)
1621  {
1622 
1623  if(i==0) {
1624 
1625  if(rate_table.QMin == 0)
1626  Val[j]= rate_table.HMin;
1627 
1628  else
1629  Val[j] = stg_int;
1630 
1631  Sh[j++]=0;
1632  Val[j]=rate_table.Shift.Val[i];
1633  Sh[j++]=rate_table.Shift.Sh[i];
1634  }
1635 
1636  else {
1637 
1638  Val[j]=rate_table.Shift.Val[i];
1639  Sh[j++]=rate_table.Shift.Sh[i];
1640  }
1641  }
1642  else {
1643 
1644  if(i!=0)
1645  break;
1646 
1647  else {
1648  Val[j]=rate_table.Shift.Val[i];
1649  Sh[j++]=rate_table.Shift.Sh[i];
1650  }
1651  }
1652  }
1653  }
1654 
1655 
1656  if(Val[0] > Val[1])
1657  {
1658 
1659  for(i = 0; i < j; i++){
1660  Val[i] = Val[i+1];
1661  Sh[i] = Sh[i+1];
1662  }
1663  if(j != 0)
1664  j = j-1;
1665  }
1666 
1667 
1668 
1669 max=j;
1670 Val[max] = -1;
1671 
1673 
1674 /*save hb5 id */
1675 
1676 strcpy(savehb5,hb5in);
1677 savepe1 = pe1;
1678 savepe2 = pe2;
1679 
1680 return (1);
1681 }
1682 
1683 /*****************************STAGE TO FLOW*********************************/
1684 /*-------------------------------------------------------------------------
1685  This function shifts the given stage, finds where the shifted stage is
1686  in the given rating table and then calls the appropriate function to do
1687  the actual conversion.
1688  Precondition: Given a rating table structure,
1689  and a stage
1690  Postcondition: Converts the stage to flow,
1691  gives a warning flag if above or below
1692 --------------------------------------------------------------------------*/
1693 int GetFlow(char *ihb5,char pe1,char pe2,int zdate,double Stage, int *Warning)
1694 {
1695  int Flow, temp, err,i;
1696  double ShiftStage,Level;
1697 
1698 /* check if we have valid table */
1699  temp = strcmp(ihb5, savehb5);
1700 
1701 /* check to see if the parameter code is different */
1702  if((pe1 != savepe1)||(pe2 != savepe2))
1703  temp =1;
1704 
1705 /*if not a valid table*/
1706  if(rate_table.edate != -1)
1707  {
1708  if((temp != 0) || ((zdate < rate_table.bdate) ||
1709  (zdate >= rate_table.edate)))
1710  {
1711  err = get_rate(ihb5,pe1,pe2,zdate);
1712  if(err != 1){
1713  *Warning = -1;
1714  return -1;
1715  }
1716  }
1717  }
1718 
1719  else if(rate_table.edate == -1)
1720  {
1721  if((temp != 0) || (zdate < rate_table.bdate))
1722  {
1723  err = get_rate(ihb5,pe1,pe2,zdate);
1724  if(err != 1){
1725  *Warning = -1;
1726  return -1;
1727  }
1728  }
1729  }
1730 
1733 if(max==0)
1734  ShiftStage=Stage;
1735 
1736 else if(max==1)
1737  ShiftStage = Stage + Sh[0];
1738 
1739 else if(Stage < Val[0])
1740  ShiftStage = Stage + Sh[0];
1741 
1742 else if(Stage >= Val[max-1])
1743  ShiftStage = Stage + Sh[max-1];
1744 
1745 else {
1746 
1747  for(i=0; i<max; i++) {
1748 
1749  if((Stage >= Val[i]) && (Stage < Val[i+1])){
1750 
1751  ShiftStage = Stage + Sh[i] + (Stage-Val[i]) *(Sh[i+1]-Sh[i])/
1752  (Val[i+1]-Val[i]);
1753  break;
1754  }
1755 
1756  }
1757 
1758 }
1759 
1760 if( ShiftStage < rate_table.HMin)
1761  {
1762  Flow = 0;
1763 /*
1764  Flow = BelowStage2Flow( rate_table, ShiftStage);
1765 */
1766  *Warning = 1;
1767  return Flow;
1768  }
1769 
1770 else if( ShiftStage > rate_table.HMax)
1771  {
1772  Flow = 0;
1773  *Warning=2;
1774 /*
1775  Flow = AboveStage2Flow(rate_table, ShiftStage);
1776  if (Flow == -1)
1777  {
1778  *Warning = 3;
1779  return Flow;
1780  }
1781  else
1782  {
1783  *Warning = 2;
1784  return Flow;
1785  }
1786 */
1787  }
1788 
1789 for( i = 0; i <= rate_table.AryMax; i++)
1790  {
1791  Level = rate_table.RatStg[i] - ShiftStage;
1792  if( Level == 0)
1793  {
1794  Flow = ExactStage2Flow(rate_table, i);
1795  *Warning = 0;
1796  return Flow;
1797  }
1798 
1799  if( Level > 0)
1800  {
1801  Flow=InterpolateStage2Flow(rate_table, ShiftStage, i);
1802  *Warning = 0;
1803  return Flow;
1804  }
1805  }
1806 }
1807 
1808 
1809 /*-------------------------------------------------------------------------
1810  This function converts stage to flow when the given stage is below the
1811  given rating table.
1812 -------------------------------------------------------------------------*/
1813 int BelowStage2Flow( RatingTable rate_table, double ShiftStage)
1814 {
1815  int Flow;
1816  double flow;
1817 
1818 
1819 
1820  if(rate_table.HMin == 0)
1821  Flow = 0;
1822 
1823  else /* calculate flow using y = mx + b(where y=flow,x=stg) */
1824  {
1825 
1826  flow = Slope*ShiftStage + b;
1827  Flow = flow;
1828 
1829  if(Flow < 0)
1830  Flow = 0;
1831  return(Flow);
1832 
1833  }
1834 }
1835 
1836 
1837 /*-------------------------------------------------------------------------
1838  This function converts stage to flow when the given stage is above the
1839  given rating table.
1840 ---------------------------------------------------------------------------*/
1841 int AboveStage2Flow( RatingTable rate_table, double ShiftStage)
1842 {
1843 
1844  double
1845  flow,
1846  Del,
1847  Slope,
1848  Var1;
1849  int
1850  Flow;
1851 
1852 
1853  Del = log10(rate_table.HMax) -
1854  log10(rate_table.RatStg[rate_table.AryMax - 2]);
1855 
1856  Slope = (log10(rate_table.QMax) -
1857  log10(rate_table.RatQ[rate_table.AryMax - 2])) / Del;
1858 
1859  Var1 = log10(rate_table.QMax);
1860  flow = Var1 + (Slope * (log10(ShiftStage) -
1861  log10(rate_table.HMax)));
1862 
1863  if(flow > 8.3)
1864  {
1865  return -1;
1866  }
1867 
1868  else
1869  {
1870  flow = pow(10.0,flow);
1871  Flow = flow;
1872  return Flow;
1873  }
1874 }
1875 
1876 
1877 /*-----------------------------------------------------------------------
1878  This function converts stage to flow when the given stage is exactly
1879  one of the stages in the given rating table.
1880 -------------------------------------------------------------------------*/
1882 {
1883  double flow = rate_table.RatQ[i];
1884  int Flow = flow;
1885  return Flow;
1886 }
1887 
1888 
1889 /*------------------------------------------------------------------------
1890  This function converts stage to flow when the given stage is in between
1891  the stages in the given rating table.
1892 --------------------------------------------------------------------------*/
1893 int InterpolateStage2Flow( RatingTable rate_table, double ShiftStage, int i)
1894 {
1895 
1896  double
1897  flow,
1898  Del,
1899  Slope,
1900  Var2;
1901  int
1902  Flow,
1903  High = i,
1904  Low = i - 1;
1905 
1906 
1907  if((rate_table.RatStg[Low] == 0)&&(rate_table.RatQ[Low] == 0))
1908  {
1909  Flow = 0;
1910  return Flow;
1911  }
1912 
1913  else if(rate_table.RatQ[Low] == 0)
1914  rate_table.RatQ[Low] = 1;
1915 
1916  Del = log10(rate_table.RatStg[High]) - log10(rate_table.RatStg[Low]);
1917  Slope = (log10(rate_table.RatQ[High]) -
1918  log10(rate_table.RatQ[Low])) / Del;
1919 
1920  Var2 = log10(rate_table.RatQ[Low]);
1921  flow = Var2 + (Slope * (log10(ShiftStage) -
1922  log10(rate_table.RatStg[Low])));
1923 
1924  flow = pow(10.0,flow);
1925  Flow = flow;
1926 
1927  return Flow;
1928 }
1929 
1930 /********************************FLOW TO STAGE*****************************/
1931 
1932 /*-------------------------------------------------------------------------
1933  This function finds where the given flow is in the given rating table,
1934  calls the appropriate function to do the actual conversion, and then
1935  shifts the stage that was returned.
1936  Precondition: Given a rating table structure,
1937  and a flow
1938  Postcondition: Converts the flow to stage,
1939  gives a warning flag if above or below
1940 --------------------------------------------------------------------------*/
1941 double GetStage(char *ihb5,char pe1,char pe2,int zdate,int Flow,int *Warning)
1942 
1943 {
1944  int i, temp2, err2, Round;
1945 
1946  double Stage, Level, ShiftStage, Round_ShiftStage;
1947 
1948 
1949 /* check if we have valid table */
1950  temp2 = strcmp(savehb5, ihb5);
1951 
1952 /* check to see if the parameter code is different */
1953  if((pe1 != savepe1)||(pe2 != savepe2))
1954  temp2 = 3;
1955 
1956 /*if not a valid table*/
1957 
1958  if(rate_table.edate != -1)
1959  {
1960  if((temp2 != 0) || ((zdate < rate_table.bdate) ||
1961  (zdate >= rate_table.edate)))
1962  {
1963  err2 = get_rate(ihb5,pe1,pe2,zdate);
1964 
1965  if(err2 != 1){
1966  *Warning = -1;
1967  return -1;}
1968  }
1969  }
1970 
1971  else if(rate_table.edate == -1)
1972  {
1973  if((temp2 != 0) || (zdate < rate_table.bdate))
1974  {
1975  err2 = get_rate(ihb5,pe1,pe2,zdate);
1976 
1977  if(err2 != 1){
1978  *Warning = -1;
1979  return -1;}
1980  }
1981  }
1982 
1983 /* Call appropriate flow2stage function */
1984  if( Flow < rate_table.QMin)
1985  Stage = BelowFlow2Stage(rate_table, Flow);
1986 
1987  else if( Flow > rate_table.QMax)
1988  Stage = AboveFlow2Stage(rate_table, Flow);
1989 
1990  else{
1991 
1992  for( i = 0; i <= rate_table.AryMax; i++)
1993  {
1994  Level = rate_table.RatQ[i] - Flow;
1995  if( Level == 0)
1996  {
1997  Stage = ExactFlow2Stage(rate_table, i);
1998  break;
1999  }
2000 
2001  if( Level > 0)
2002  {
2003  Stage = InterpolateFlow2Stage(rate_table, Flow, i);
2004  break;
2005  }
2006  }
2007  }
2008 
2011 if(max==0)
2012  ShiftStage = Stage;
2013 
2014 else if(max == 1)
2015  ShiftStage = Stage - Sh[0];
2016 
2017 else if(Stage < Val[0] + Sh[0])
2018  ShiftStage = Stage - Sh[0];
2019 
2020 else if(Stage >= Val[max-1] + Sh[max-1])
2021  ShiftStage = Stage - Sh[max-1];
2022 
2023 else {
2024 
2025  for(i=0; i<max; i++) {
2026 
2027  if((Stage >= Val[i]+Sh[i]) && (Stage < Val[i+1] + Sh[i+1])){
2028 
2029  ShiftStage = Stage - Sh[i] - (Stage-(Val[i]+Sh[i])) *
2030  (Sh[i+1]-Sh[i])/(Val[i+1]+Sh[i+1]-(Val[i]+Sh[i]));
2031 
2032  break;
2033  }
2034 
2035  }
2036 
2037 }
2038 
2040  if(ShiftStage > 0)
2041  Round = (ShiftStage*100) + .5;
2042  else
2043  Round = (ShiftStage*100) - .5;
2044  Round_ShiftStage = (double)Round/100;
2045 
2046  if((Round_ShiftStage < rate_table.HMin) && (Round_ShiftStage >= 0))
2047  *Warning = 1;
2048 
2049  else if(Round_ShiftStage > rate_table.HMax)
2050  *Warning = 2;
2051 
2052  else if(Round_ShiftStage < 0)
2053  *Warning = 3;
2054 
2055  else
2056  *Warning = 0;
2057 
2058 
2059 return Round_ShiftStage;
2060 
2061 }
2062 
2063 /*-------------------------------------------------------------------------
2064  This function converts flow to stage when the given flow is below the
2065  given rating table.
2066 -------------------------------------------------------------------------*/
2068 {
2069  double flow = Flow;
2070  /*double Slope = rate_table.HMin / rate_table.QMin;
2071  double Stage = flow * Slope;*/
2072 
2073  double Stage = (flow - b)/Slope;
2074 
2075  return Stage;
2076 }
2077 
2078 
2079 
2080 /*-------------------------------------------------------------------------
2081  This function converts flow to stage when the given flow is above the
2082  given rating table.
2083 ---------------------------------------------------------------------------*/
2085 {
2086  double
2087  flow,
2088  Del,
2089  Slope,
2090  Var1,
2091  Stage;
2092 
2093  flow = Flow;
2094 
2095  if(Flow == 200000000)
2096  return Stage = -10;
2097  else{
2098 
2099  Del = log10((double)rate_table.QMax) -
2100  log10((double)rate_table.RatQ[rate_table.AryMax - 2]);
2101 
2102  Slope = (log10(rate_table.HMax) -
2103  log10(rate_table.RatStg[rate_table.AryMax - 2])) /Del;
2104 
2105  Var1 = log10(rate_table.HMax);
2106  Stage = Var1 + (Slope * (log10(flow) -
2107  log10((double)rate_table.QMax)));
2108  Stage = pow(10.0,Stage);
2109 
2110  return Stage;
2111  }
2112 }
2113 
2114 
2115 /*-----------------------------------------------------------------------
2116  This function converts flow to stage when the given flow is exactly
2117  one of the flows in the given rating table.
2118 -------------------------------------------------------------------------*/
2120 {
2121  double Stage = rate_table.RatStg[i];
2122 
2123  return Stage;
2124 }
2125 
2126 
2127 
2128 /*------------------------------------------------------------------------
2129  This function converts flow to stage when the given flow is in between
2130  the flows in the given rating table.
2131 --------------------------------------------------------------------------*/
2133 {
2134 
2135  double
2136  flow,
2137  Del,
2138  Slope,
2139  Var2,
2140  Stage;
2141  int
2142  High = i,
2143  Low = i - 1;
2144  flow = Flow;
2145 
2146  if(rate_table.RatQ[Low] == 0)
2147  rate_table.RatQ[Low] = 1;
2148 
2149  Del = log10((double)rate_table.RatQ[High]) -
2150  log10((double)rate_table.RatQ[Low]);
2151 
2152  Slope = (log10(rate_table.RatStg[High]) -
2153  log10(rate_table.RatStg[Low])) / Del;
2154 
2155  Var2 = log10(rate_table.RatStg[Low]);
2156  Stage = Var2 + (Slope * (log10(flow) -
2157  log10((double)rate_table.RatQ[Low])));
2158  Stage = pow(10.0,Stage);
2159 
2160  return Stage;
2161 }
2162 
2163 
2164 /*------------------------------------------------------------------------
2165  This function gets all the rating curve information and then returns it.
2166 -------------------------------------------------------------------------*/
2167 RatingTable getrc(char *ihb5,char pe1,char pe2,int zdate,int *Warning)
2168 {
2169 int err;
2170 
2171 err = get_rate(ihb5,pe1,pe2,zdate);
2172 *Warning = err;
2173 
2174 return rate_table;
2175 
2176 }
2177 
2178 
2179 
2180 
2181 #line 1249 "rat.ec"
char pe2
Definition: build_list.c:122
char pe1
Definition: build_list.c:122
struct eens_rec bens_rec
Widget err
Definition: daily_qc.c:163
printf("pcp %d\n", pcp_in_use[103])
RatingTable getrc(char *ihb5, char pe1, char pe2, int zdate, int *Warning)
Definition: rat.c:2167
static double b
Definition: rat.c:142
double GetStage(char *ihb5, char pe1, char pe2, int zdate, int Flow, int *Warning)
Definition: rat.c:1941
static double stg_int
Definition: rat.c:142
static RatingTable rate_table
Definition: rat.c:138
int AboveStage2Flow(RatingTable rate_table, double ShiftStage)
Definition: rat.c:1841
double InterpolateFlow2Stage(RatingTable rate_table, int Flow, int i)
Definition: rat.c:2132
static double Slope
Definition: rat.c:142
int BelowStage2Flow(RatingTable rate_table, double ShiftStage)
Definition: rat.c:1813
int get_rate(char *hb5in, char pe1, char pe2, int zdate)
Definition: rat.c:152
static const char _Cn1[]
Definition: rat.c:4
static int begin_year
Definition: rat.c:140
static int begin_day
Definition: rat.c:140
static char savepe2
Definition: rat.c:137
static const char _Cn2[]
Definition: rat.c:3
double ExactFlow2Stage(RatingTable rate_table, int i)
Definition: rat.c:2119
static char savepe1
Definition: rat.c:137
static int begin_month
Definition: rat.c:140
int InterpolateStage2Flow(RatingTable rate_table, double ShiftStage, int i)
Definition: rat.c:1893
int GetFlow(char *ihb5, char pe1, char pe2, int zdate, double Stage, int *Warning)
Definition: rat.c:1693
int4 SQLCODE
struct sqlca_s ifx_sqlca_t
char SQLSTATE[]
struct sqlca_s sqlca
static double Val[10]
Definition: rat.c:142
static ShiftTable shift_table
Definition: rat.c:139
double BelowFlow2Stage(RatingTable rate_table, int Flow)
Definition: rat.c:2067
double AboveFlow2Stage(RatingTable rate_table, int Flow)
Definition: rat.c:2084
static double Sh[10]
Definition: rat.c:142
int ExactStage2Flow(RatingTable rate_table, int i)
Definition: rat.c:1881
static int max
Definition: rat.c:141
static char savehb5[10]
Definition: rat.c:136
double hist_stg
Definition: rate_table.h:26
ShiftTable Shift
Definition: rate_table.h:14
int RatQ[200]
Definition: rate_table.h:13
double HMax
Definition: rate_table.h:16
int hist_date
Definition: rate_table.h:28
double HMin
Definition: rate_table.h:15
double wrn
Definition: rate_table.h:20
double RatStg[200]
Definition: rate_table.h:12
double fld
Definition: rate_table.h:21
double Val[4]
Definition: rate_table.h:3
double Sh[4]
Definition: rate_table.h:4
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 ok[2]
Definition: pcprpt_daily.c:267
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
long sqlerrd[6]
Definition: build_list.c:50
int4 sqlcode
Definition: rat.c:55
struct sqlca_s::sqlcaw_s sqlwarn
char sqlerrm[72]
Definition: build_list.c:48
char sqlerrp[8]
Definition: build_list.c:49