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