Mapper
map_load.c
Go to the documentation of this file.
1 #include <sqlhdr.h>
2 #include <sqliapi.h>
3 static const char _Cn5[] = "loop_fcst";
4 static const char _Cn4[] = "loop_area_sens";
5 static const char _Cn3[] = "loop_seg";
6 static const char _Cn2[] = "loop_fg";
7 static const char _Cn1[] = "qfg";
8 #line 1 "map_load.ec"
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include <string.h>
12 #include <errno.h>
13 #include <ctype.h>
14 #include <sys/time.h>
15 #include <sys/types.h>
16 #include <sys/stat.h>
17 
18 #include <X11/Xos.h>
19 #include <Xm/Text.h>
20 #include <Xm/TextF.h>
21 
22 #include "mm2rfs.h"
23 
24 /* external variables */
25 extern Widget text_output;
26 extern int fg_toggle_item_set;
27 extern int parm_toggle_item_set;
28 extern int dur_toggle_item_set;
29 extern int src_toggle_item_set;
30 extern int ver_toggle_item_set;
31 extern int debug;
32 
33 extern struct fgroup_info fg[20];
34 extern struct time_cntl tc;
35 
36 int map_load(struct map_struct *map)
37 {
38 char line[256];
39 int i;
40 int num_maps=-1;
41 int loop_fcst_err,loop_fg_err,loop_seg_err,loop_area_sens_err;
42 
43 /* declare informix host variables */
44 /*
45  * exec sql begin declare section;
46  */
47 #line 36 "map_load.ec"
48 #line 37 "map_load.ec"
49  char areaid[6];
50  char fgroupid[9], segid[9], rfs_id[9], wfo_resp[4];
51  char drain[2], pos[2], cgroup[2];
52  char pe1[2], pe2[2], dur[2], t[2], s[2], e[2], p[2];
53  char src[2];
54  char qz00[2], qz06[2], qz12[2], qz18[2];
55  char query[256];
56 int pos_order;
57 int vcal_yr, vmon, vzday, vhour;
58 int segnum;
59 int size_mi2;
60 float z00, z06, z12, z18;
61 /*
62  * exec sql end declare section;
63  */
64 #line 49 "map_load.ec"
65 
66 
67 /*
68  * exec sql set isolation to dirty read;
69  */
70 #line 51 "map_load.ec"
71  {
72 #line 51 "map_load.ec"
73  static const char *sqlcmdtxt[] =
74 #line 51 "map_load.ec"
75  {
76 #line 51 "map_load.ec"
77  "set isolation to dirty read",
78  0
79  };
80 #line 51 "map_load.ec"
81  static ifx_statement_t _SQ0 = {0};
82 #line 51 "map_load.ec"
83  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);
84 #line 51 "map_load.ec"
85  }
86 
87  /* database should already be open */
88 
89  /* establish data source */
90  if(src_toggle_item_set==1)
91  strcpy(src,"B"); /* composite */
92  else
93  strcpy(src,"E"); /* wfo */
94 
95  /* set up loop to find selected or all (*) forecast groups */
96  if(fg_toggle_item_set < 0)
97  {
98  sprintf(query,"select fgroupid "
99  "from fgroup");
100  }
101  else
102  {
103  sprintf(query,"select fgroupid "
104  "from fgroup "
105  "where fgroupid matches \"%s\"",
106  fg[fg_toggle_item_set].id);
107  }
108 
109 /*
110  * $prepare qfg from $query;
111  */
112 #line 75 "map_load.ec"
113  {
114 #line 75 "map_load.ec"
115  sqli_prep(ESQLINTVERSION, _Cn1, query,(ifx_literal_t *)0, (ifx_namelist_t *)0, -1, 0, 0 );
116 #line 75 "map_load.ec"
117  }
118  if(sqlca.sqlcode)
119  {
120  sprintf(line,"prepare qfg failed (%d)",sqlca.sqlcode);
121  XmTextFieldSetString (text_output, line);
122  return(-1);
123  }
124 
125 /*
126  * $declare loop_fg cursor for qfg;
127  */
128 #line 83 "map_load.ec"
129  {
130 #line 83 "map_load.ec"
131  sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn2, 512), _Cn2, sqli_curs_locate(ESQLINTVERSION, _Cn1, 513), 0, 0);
132 #line 83 "map_load.ec"
133  }
134  if(sqlca.sqlcode)
135  {
136  sprintf(line,"declare loop_fg failed (%d)",sqlca.sqlcode);
137  XmTextFieldSetString (text_output, line);
138  return(-1);
139  }
140 /*
141  * $open loop_fg;
142  */
143 #line 90 "map_load.ec"
144  {
145 #line 90 "map_load.ec"
146  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn2, 768), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
147 #line 90 "map_load.ec"
148  }
149  if(sqlca.sqlcode)
150  {
151  sprintf(line,"open loop_fg failed (%d)",sqlca.sqlcode);
152  XmTextFieldSetString (text_output, line);
153  return(-1);
154  }
155  loop_fg_err=sqlca.sqlcode;
156 
157 
158  /* loop here for multiple forecast groups */
159  while(!loop_fg_err)
160  {
161 /*
162  * $fetch next loop_fg into $fgroupid;
163  */
164 #line 103 "map_load.ec"
165  {
166 #line 103 "map_load.ec"
167  static ifx_sqlvar_t _sqobind[] =
168  {
169  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
170 #line 103 "map_load.ec"
171  };
172  static ifx_sqlda_t _SD0 = { 1, _sqobind, {0}, 1, 0 };
173  static _FetchSpec _FS1 = { 0, 1, 0 };
174 #line 103 "map_load.ec"
175  _sqobind[0].sqldata = fgroupid;
176  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn2, 768), (ifx_sqlda_t *)0, &_SD0, (char *)0, &_FS1);
177 #line 103 "map_load.ec"
178  }
179  loop_fg_err=sqlca.sqlcode;
180  if(!loop_fg_err)
181  {
182 
183 /*
184  * $declare loop_seg cursor for select segid,segnum
185  * from fgroup_seg
186  * where fgroupid=$fgroupid
187  * order by segnum;
188  */
189 #line 108 "map_load.ec"
190  {
191 #line 111 "map_load.ec"
192  static const char *sqlcmdtxt[] =
193 #line 111 "map_load.ec"
194  {
195 #line 111 "map_load.ec"
196  "select segid , segnum from fgroup_seg where fgroupid = ? order by segnum",
197  0
198  };
199 #line 111 "map_load.ec"
200  static ifx_sqlvar_t _sqibind[] =
201  {
202  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
203 #line 111 "map_load.ec"
204  };
205  static ifx_sqlda_t _SD0 = { 1, _sqibind, {0}, 1, 0 };
206 #line 111 "map_load.ec"
207  _sqibind[0].sqldata = fgroupid;
208 #line 111 "map_load.ec"
209 sqli_curs_decl_stat(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn3, 512), _Cn3, sqlcmdtxt, &_SD0, (ifx_sqlda_t *)0, 0, (ifx_literal_t *)0, (ifx_namelist_t *)0, 2, 0, 0);
210 #line 111 "map_load.ec"
211  }
212  if(sqlca.sqlcode)
213  {
214  sprintf(line,"declare loop_seg failed (%d)",sqlca.sqlcode);
215  XmTextFieldSetString (text_output, line);
216  return(-1);
217  }
218 /*
219  * $open loop_seg;
220  */
221 #line 118 "map_load.ec"
222  {
223 #line 118 "map_load.ec"
224  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn3, 768), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
225 #line 118 "map_load.ec"
226  }
227  if(sqlca.sqlcode)
228  {
229  sprintf(line,"open loop_seg failed (%d)",sqlca.sqlcode);
230  XmTextFieldSetString (text_output, line);
231  return(-1);
232  }
233  loop_seg_err=sqlca.sqlcode;
234 
235 
236  /* loop here for multiple segments in same forecast group */
237  while(!loop_seg_err)
238  {
239 /*
240  * $fetch next loop_seg into $segid,$segnum;
241  */
242 #line 131 "map_load.ec"
243  {
244 #line 131 "map_load.ec"
245  static ifx_sqlvar_t _sqobind[] =
246  {
247  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
248  { 102, sizeof(segnum), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
249 #line 131 "map_load.ec"
250  };
251  static ifx_sqlda_t _SD0 = { 2, _sqobind, {0}, 2, 0 };
252  static _FetchSpec _FS1 = { 0, 1, 0 };
253 #line 131 "map_load.ec"
254  _sqobind[0].sqldata = segid;
255 #line 131 "map_load.ec"
256  _sqobind[1].sqldata = (char *) &segnum;
257  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn3, 768), (ifx_sqlda_t *)0, &_SD0, (char *)0, &_FS1);
258 #line 131 "map_load.ec"
259  }
260  loop_seg_err=sqlca.sqlcode;
261  if(!loop_seg_err)
262  {
263  /* loop here for multiple areas in the same segment */
264 /*
265  * $declare loop_area_sens cursor for
266  * select id,
267  * pe1,pe2,dur,t,s,e,p,
268  * drain,area_sens.pos,cgroup,rfs_id,
269  * wfo_resp,size_mi2,pos_order
270  * from area_sens,pos
271  * where segid=$segid and
272  * pe1="P" and
273  * pe2="P" and
274  * dur="Q" and
275  * t="P" and
276  * s=$src and
277  * e="Z" and
278  * p="Z" and
279  * area_sens.pos=pos.pos
280  * order by id,pos_order desc;
281  */
282 #line 136 "map_load.ec"
283  {
284 #line 151 "map_load.ec"
285  static const char *sqlcmdtxt[] =
286 #line 151 "map_load.ec"
287  {
288 #line 151 "map_load.ec"
289  "select id , pe1 , pe2 , dur , t , s , e , p , drain , area_sens . pos , cgroup , rfs_id , wfo_resp , size_mi2 , pos_order from area_sens , pos where segid = ? and pe1 = \"P\" and pe2 = \"P\" and dur = \"Q\" and t = \"P\" and s = ? and e = \"Z\" and p = \"Z\" and area_sens . pos = pos . pos order by id , pos_order desc",
290  0
291  };
292 #line 151 "map_load.ec"
293  static ifx_sqlvar_t _sqibind[] =
294  {
295  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
296  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
297 #line 151 "map_load.ec"
298  };
299  static ifx_sqlda_t _SD0 = { 2, _sqibind, {0}, 2, 0 };
300 #line 151 "map_load.ec"
301  _sqibind[0].sqldata = segid;
302 #line 151 "map_load.ec"
303  _sqibind[1].sqldata = src;
304 #line 151 "map_load.ec"
305 sqli_curs_decl_stat(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn4, 512), _Cn4, sqlcmdtxt, &_SD0, (ifx_sqlda_t *)0, 0, (ifx_literal_t *)0, (ifx_namelist_t *)0, 2, 0, 0);
306 #line 151 "map_load.ec"
307  }
308  if(sqlca.sqlcode)
309  {
310  sprintf(line,"declare loop_area_sens failed (%d)",sqlca.sqlcode);
311  XmTextFieldSetString (text_output, line);
312  return(-1);
313  }
314 /*
315  * $open loop_area_sens;
316  */
317 #line 158 "map_load.ec"
318  {
319 #line 158 "map_load.ec"
320  sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn4, 768), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
321 #line 158 "map_load.ec"
322  }
323  if(sqlca.sqlcode)
324  {
325  sprintf(line,"open loop_area_sens failed (%d)",sqlca.sqlcode);
326  XmTextFieldSetString (text_output, line);
327  return(-1);
328  }
329  loop_area_sens_err=sqlca.sqlcode;
330 
331 
332  /* loop here for multiple elements in the same area */
333  while(!loop_area_sens_err)
334  {
335 /*
336  * $fetch next loop_area_sens into $areaid,
337  * $pe1,$pe2,$dur,$t,$s,$e,$p,
338  * $drain,$pos,$cgroup,$rfs_id,
339  * $wfo_resp,$size_mi2,$pos_order;
340  */
341 #line 171 "map_load.ec"
342  {
343 #line 174 "map_load.ec"
344  static ifx_sqlvar_t _sqobind[] =
345  {
346  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
347  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
348  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
349  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
350  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
351  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
352  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
353  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
354  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
355  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
356  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
357  { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
358  { 100, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
359  { 102, sizeof(size_mi2), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
360  { 102, sizeof(pos_order), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
361 #line 174 "map_load.ec"
362  };
363  static ifx_sqlda_t _SD0 = { 15, _sqobind, {0}, 15, 0 };
364  static _FetchSpec _FS1 = { 0, 1, 0 };
365 #line 174 "map_load.ec"
366  _sqobind[0].sqldata = areaid;
367 #line 174 "map_load.ec"
368  _sqobind[1].sqldata = pe1;
369 #line 174 "map_load.ec"
370  _sqobind[2].sqldata = pe2;
371 #line 174 "map_load.ec"
372  _sqobind[3].sqldata = dur;
373 #line 174 "map_load.ec"
374  _sqobind[4].sqldata = t;
375 #line 174 "map_load.ec"
376  _sqobind[5].sqldata = s;
377 #line 174 "map_load.ec"
378  _sqobind[6].sqldata = e;
379 #line 174 "map_load.ec"
380  _sqobind[7].sqldata = p;
381 #line 174 "map_load.ec"
382  _sqobind[8].sqldata = drain;
383 #line 174 "map_load.ec"
384  _sqobind[9].sqldata = pos;
385 #line 174 "map_load.ec"
386  _sqobind[10].sqldata = cgroup;
387 #line 174 "map_load.ec"
388  _sqobind[11].sqldata = rfs_id;
389 #line 174 "map_load.ec"
390  _sqobind[12].sqldata = wfo_resp;
391 #line 174 "map_load.ec"
392  _sqobind[13].sqldata = (char *) &size_mi2;
393 #line 174 "map_load.ec"
394  _sqobind[14].sqldata = (char *) &pos_order;
395  sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn4, 768), (ifx_sqlda_t *)0, &_SD0, (char *)0, &_FS1);
396 #line 174 "map_load.ec"
397  }
398  loop_area_sens_err=sqlca.sqlcode;
399 
400  if(!loop_area_sens_err)
401  {
402 
403  /* collect values and load into structure */
404  num_maps++;
405  strcpy(map[num_maps].fgroupid,fgroupid);
406  strcpy(map[num_maps].segid,segid);
407  strcpy(map[num_maps].areaid,areaid);
408  strcpy(map[num_maps].drain,drain);
409  strcpy(map[num_maps].pos,pos);
410  strcpy(map[num_maps].cgroup,cgroup);
411  sprintf(map[num_maps].shefpc,
412  "%s%s%s%s%s%s%s",pe1,pe2,dur,t,s,e,p);
413  strcpy(map[num_maps].mapid,rfs_id);
414  strcpy(map[num_maps].wfo_resp,wfo_resp);
415  map[num_maps].size_mi2=size_mi2;
416 
417  for(i=0;i<12;i++)
418  {
419  map[num_maps].per[i].amt=0.;
420  strcpy(map[num_maps].per[i].qual,"M");
421  strcpy(map[num_maps].per[i].src,s);
422  }
423 
424  for(i=0;i<=3;i++)
425  {
426  if(!i)
427  adj_time((tc.period-1)*(-6)-24,
428  tc.year,tc.month,tc.day,tc.hour,
429  &vcal_yr,&vmon,&vzday,&vhour);
430  else
431  adj_time(24,vcal_yr,vmon,vzday,vhour,
432  &vcal_yr,&vmon,&vzday,&vhour);
433 
434 /*
435  * $select z00,z06,z12,z18,qz00,qz06,qz12,qz18
436  * into $z00,$z06,$z12,$z18,$qz00,$qz06,$qz12,$qz18
437  * from maqtrly
438  * where id=$areaid and drain=$drain and pos=$pos and
439  * cgroup=$cgroup and
440  * pe1=$pe1 and pe2=$pe2 and dur=$dur and
441  * t=$t and s=$src and e=$e and p=$p and
442  * cal_yr=$vcal_yr and mon=$vmon and zday=$vzday;
443  */
444 #line 211 "map_load.ec"
445  {
446 #line 218 "map_load.ec"
447  static const char *sqlcmdtxt[] =
448 #line 218 "map_load.ec"
449  {
450 #line 218 "map_load.ec"
451  "select z00 , z06 , z12 , z18 , qz00 , qz06 , qz12 , qz18 from maqtrly where id = ? and drain = ? and pos = ? and cgroup = ? and pe1 = ? and pe2 = ? and dur = ? and t = ? and s = ? and e = ? and p = ? and cal_yr = ? and mon = ? and zday = ?",
452  0
453  };
454 #line 218 "map_load.ec"
455 static ifx_cursor_t _SQ0 = {0};
456  static ifx_sqlvar_t _sqibind[] =
457  {
458  { 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
459  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
460  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
461  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
462  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
463  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
464  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
465  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
466  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
467  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
468  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
469  { 102, sizeof(vcal_yr), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
470  { 102, sizeof(vmon), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
471  { 102, sizeof(vzday), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
472 #line 218 "map_load.ec"
473  };
474  static ifx_sqlvar_t _sqobind[] =
475  {
476  { 104, sizeof(z00), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
477  { 104, sizeof(z06), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
478  { 104, sizeof(z12), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
479  { 104, sizeof(z18), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
480  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
481  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
482  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
483  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
484 #line 218 "map_load.ec"
485  };
486 #line 218 "map_load.ec"
487  _sqibind[0].sqldata = areaid;
488 #line 218 "map_load.ec"
489  _sqibind[1].sqldata = drain;
490 #line 218 "map_load.ec"
491  _sqibind[2].sqldata = pos;
492 #line 218 "map_load.ec"
493  _sqibind[3].sqldata = cgroup;
494 #line 218 "map_load.ec"
495  _sqibind[4].sqldata = pe1;
496 #line 218 "map_load.ec"
497  _sqibind[5].sqldata = pe2;
498 #line 218 "map_load.ec"
499  _sqibind[6].sqldata = dur;
500 #line 218 "map_load.ec"
501  _sqibind[7].sqldata = t;
502 #line 218 "map_load.ec"
503  _sqibind[8].sqldata = src;
504 #line 218 "map_load.ec"
505  _sqibind[9].sqldata = e;
506 #line 218 "map_load.ec"
507  _sqibind[10].sqldata = p;
508 #line 218 "map_load.ec"
509  _sqibind[11].sqldata = (char *) &vcal_yr;
510 #line 218 "map_load.ec"
511  _sqibind[12].sqldata = (char *) &vmon;
512 #line 218 "map_load.ec"
513  _sqibind[13].sqldata = (char *) &vzday;
514 #line 218 "map_load.ec"
515  _sqobind[0].sqldata = (char *) &z00;
516 #line 218 "map_load.ec"
517  _sqobind[1].sqldata = (char *) &z06;
518 #line 218 "map_load.ec"
519  _sqobind[2].sqldata = (char *) &z12;
520 #line 218 "map_load.ec"
521  _sqobind[3].sqldata = (char *) &z18;
522 #line 218 "map_load.ec"
523  _sqobind[4].sqldata = qz00;
524 #line 218 "map_load.ec"
525  _sqobind[5].sqldata = qz06;
526 #line 218 "map_load.ec"
527  _sqobind[6].sqldata = qz12;
528 #line 218 "map_load.ec"
529  _sqobind[7].sqldata = qz18;
530 #line 218 "map_load.ec"
531  sqli_slct(ESQLINTVERSION, &_SQ0,sqlcmdtxt,14,_sqibind,8,_sqobind,0,(ifx_literal_t *)0,(ifx_namelist_t *)0,0);
532 #line 218 "map_load.ec"
533  }
534 
535  if(debug)
536  printf("%s %s%s%s %s%s%s%s%s%s%s %d %d "
537  "%5.2f/%s %5.2f/%s %5.2f/%s %5.2f/%s "
538  "(%d)\n",
539  areaid,drain,pos,cgroup,pe1,pe2,dur,t,src,e,p,
540  vmon,vzday,z00,qz00,z06,qz06,z12,qz12,z18,qz18,
541  sqlca.sqlcode);
542  if(!sqlca.sqlcode)
543  {
544  /* set missing values to 0.0 */
545  if(!strcmp(qz00,"M")) z00=0.;
546  if(!strcmp(qz06,"M")) z06=0.;
547  if(!strcmp(qz12,"M")) z12=0.;
548  if(!strcmp(qz18,"M")) z18=0.;
549  if(!i)
550  {
551  map[num_maps].per[0].amt=z18;
552  strcpy(map[num_maps].per[0].qual,qz18);
553  }
554  else
555  {
556  map[num_maps].per[1+4*(i-1)].amt=z00;
557  strcpy(map[num_maps].per[1+4*(i-1)].qual,qz00);
558  map[num_maps].per[2+4*(i-1)].amt=z06;
559  strcpy(map[num_maps].per[2+4*(i-1)].qual,qz06);
560  map[num_maps].per[3+4*(i-1)].amt=z12;
561  strcpy(map[num_maps].per[3+4*(i-1)].qual,qz12);
562  if(i<3)
563  {
564  map[num_maps].per[4+4*(i-1)].amt=z18;
565  strcpy(map[num_maps].per[4+4*(i-1)].qual,qz18);
566  }
567  }
568  }
569 /*
570  * $close loop_fcst;
571  */
572 #line 254 "map_load.ec"
573  {
574 #line 254 "map_load.ec"
575  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn5, 768));
576 #line 254 "map_load.ec"
577  }
578 /*
579  * $free loop_fcst;
580  */
581 #line 254 "map_load.ec"
582  {
583 #line 254 "map_load.ec"
584  sqli_curs_free(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn5, 770));
585 #line 254 "map_load.ec"
586  }
587  }
588  if(debug)
589  {
590  for(i=0;i<12;i++)
591  printf("%5.2f/%s",
592  map[num_maps].per[i].amt,map[num_maps].per[i].qual);
593  printf("\n");
594  }
595  }
596  }
597 /*
598  * $close loop_area_sens;
599  */
600 #line 264 "map_load.ec"
601  {
602 #line 264 "map_load.ec"
603  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn4, 768));
604 #line 264 "map_load.ec"
605  }
606 /*
607  * $free loop_area_sens;
608  */
609 #line 264 "map_load.ec"
610  {
611 #line 264 "map_load.ec"
612  sqli_curs_free(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn4, 770));
613 #line 264 "map_load.ec"
614  }
615  }
616  }
617 /*
618  * $close loop_seg;
619  */
620 #line 266 "map_load.ec"
621  {
622 #line 266 "map_load.ec"
623  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn3, 768));
624 #line 266 "map_load.ec"
625  }
626 /*
627  * $free loop_seg;
628  */
629 #line 266 "map_load.ec"
630  {
631 #line 266 "map_load.ec"
632  sqli_curs_free(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn3, 770));
633 #line 266 "map_load.ec"
634  }
635  }
636  }
637 /*
638  * $close loop_fg;
639  */
640 #line 268 "map_load.ec"
641  {
642 #line 268 "map_load.ec"
643  sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn2, 768));
644 #line 268 "map_load.ec"
645  }
646 /*
647  * $free loop_fg;
648  */
649 #line 268 "map_load.ec"
650  {
651 #line 268 "map_load.ec"
652  sqli_curs_free(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, _Cn2, 770));
653 #line 268 "map_load.ec"
654  }
655 
656  /* change array ptr to total count */
657  num_maps++;
658 
659  return(num_maps);
660 }
661 
662 #line 274 "map_load.ec"
int adj_time(int adj, int y, int m, int d, int h, int *adj_y, int *adj_m, int *adj_d, int *adj_h)
Definition: adj_time.c:10
static int i
struct sqlca_s sqlca
char qual[10]
Definition: subdisplay.c:33
sprintf(fbuf,"/usr/mapper/nexrad/ngrid.%02d-%02d-%02d-%02d", year, month, day, hour)
printf("fbuf is %s\n", fbuf)
static const char _Cn3[]
Definition: map_load.c:5
int map_load(struct map_struct *map)
Definition: map_load.c:36
struct fgroup_info fg[20]
static const char _Cn1[]
Definition: map_load.c:7
int parm_toggle_item_set
static const char _Cn4[]
Definition: map_load.c:4
static const char _Cn2[]
Definition: map_load.c:6
int ver_toggle_item_set
static const char _Cn5[]
Definition: map_load.c:3
Widget text_output
int fg_toggle_item_set
int debug
Definition: hydro_data.h:53
int src_toggle_item_set
int dur_toggle_item_set
struct time_cntl tc
float value
Definition: misc.h:236
long sqlcode
Definition: db.c:44