16 #line 1 "/opt/informix/incl/esql/sqlca.h"
98 #define SQLNOTFOUND 100
107 extern int4 * ifx_sqlcode();
108 extern struct sqlca_s * ifx_sqlca();
109 #define SQLCODE (*(ifx_sqlcode()))
110 #define SQLSTATE ((char *)(ifx_sqlstate()))
111 #define sqlca (*(ifx_sqlca()))
120 #line 103 "/opt/informix/incl/esql/sqlca.h"
121 #line 8 "get_nam2.ec"
141 void get_nam2(sid, sid_s, wshed, wshed_s, river, river_s,
146 #line 29 "get_nam2.ec"
147 #line 30 "get_nam2.ec"
148 #line 30 "get_nam2.ec"
149 #line 30 "get_nam2.ec"
152 #line 31 "get_nam2.ec"
153 #line 31 "get_nam2.ec"
156 #line 32 "get_nam2.ec"
157 #line 32 "get_nam2.ec"
160 #line 33 "get_nam2.ec"
161 #line 33 "get_nam2.ec"
164 #line 34 "get_nam2.ec"
169 #line 35 "get_nam2.ec"
175 #line 37 "get_nam2.ec"
176 #line 38 "get_nam2.ec"
177 #line 38 "get_nam2.ec"
178 static char dbname[200];
179 #line 39 "get_nam2.ec"
180 static char thuc1[9], twshed[31], nam[51];
181 #line 40 "get_nam2.ec"
182 static long int task, error, n,
i, i_;
183 #line 41 "get_nam2.ec"
188 #line 42 "get_nam2.ec"
191 f_strncpy( wshed,
" ", wshed_s - 1 );
192 f_strncpy( river,
" ", river_s -
194 f_strncpy( loc,
" ", loc_s - 1 );
202 fprintf(stderr,
"cannot get DBNAME var from sws.config\nassuming fastetc\n");
203 strcpy(dbname,
"fastetc");
208 #line 58 "get_nam2.ec"
210 #line 58 "get_nam2.ec"
211 sqli_db_open(dbname, 0);
212 #line 58 "get_nam2.ec"
227 #line 66 "get_nam2.ec"
229 #line 69 "get_nam2.ec"
230 static const char *sqlcmdtxt[] =
231 #line 69 "get_nam2.ec"
233 #line 69 "get_nam2.ec"
234 " select huc , des from stn where id = ?",
237 #line 69 "get_nam2.ec"
238 static ifx_cursor_t _SQ0 = {0};
239 static ifx_sqlvar_t _sqibind[] =
241 { 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
242 #line 69 "get_nam2.ec"
244 static ifx_sqlvar_t _sqobind[] =
246 { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
247 { 100, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
248 #line 69 "get_nam2.ec"
250 #line 69 "get_nam2.ec"
251 _sqibind[0].sqldata = sid;
252 #line 69 "get_nam2.ec"
253 _sqobind[0].sqldata = thuc1;
254 #line 69 "get_nam2.ec"
255 _sqobind[1].sqldata = nam;
256 #line 69 "get_nam2.ec"
257 sqli_slct(ESQLINTVERSION, &_SQ0,(
char **) sqlcmdtxt,1,_sqibind,2,_sqobind,0,(ifx_literal_t *) 0,(ifx_namelist_t *) 0,0);
258 #line 69 "get_nam2.ec"
276 #line 80 "get_nam2.ec"
278 #line 83 "get_nam2.ec"
279 static const char *sqlcmdtxt[] =
280 #line 83 "get_nam2.ec"
282 #line 83 "get_nam2.ec"
283 " select des4 from huc where code = ?",
286 #line 83 "get_nam2.ec"
287 static ifx_cursor_t _SQ0 = {0};
288 static ifx_sqlvar_t _sqibind[] =
290 { 100, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
291 #line 83 "get_nam2.ec"
293 static ifx_sqlvar_t _sqobind[] =
295 { 100, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
296 #line 83 "get_nam2.ec"
298 #line 83 "get_nam2.ec"
299 _sqibind[0].sqldata = thuc1;
300 #line 83 "get_nam2.ec"
301 _sqobind[0].sqldata = twshed;
302 #line 83 "get_nam2.ec"
303 sqli_slct(ESQLINTVERSION, &_SQ0,(
char **) sqlcmdtxt,1,_sqibind,1,_sqobind,0,(ifx_literal_t *) 0,(ifx_namelist_t *) 0,0);
304 #line 83 "get_nam2.ec"
309 f_strncpy( wshed,
" ", wshed_s - 1 );
313 f_strncpy( wshed, ntstr(twshed+0,20), wshed_s - 1 );
319 for(
i = 2;
i <= 49;
i++ )
322 if( f_strcmp(ntstr(nam+
i - 2,min(
i + 1,50) - (
i - 1) + 1),
327 f_subscpy( river, 0, 24, river_s - 1, ntstr(nam+0,25) );
328 f_subscpy( loc, 0, 24, loc_s - 1, ntstr(nam+25,25) );
332 f_strncpy( river,
" ", river_s -
337 f_subscpy( river, 0,
i - 3, river_s - 1, ntstr(nam+0,min(
i -
342 f_subscpy( river, 0, 29, river_s - 1, ntstr(nam+0,30) );
344 f_strncpy( loc,
" ", loc_s - 1 );
348 f_subscpy( loc, 0, -
i + 48, loc_s - 1, ntstr(nam+
i + 1,-(
i +
353 f_subscpy( loc, 0, 29, loc_s - 1, ntstr(nam+
i + 1,min(
i +
354 31,50) - (
i + 2) + 1) );
370 #line 146 "get_nam2.ec"
int ReadConfig(char *answer, char *query)
void get_nam2(char *sid, int sid_s, char *wshed, int wshed_s, char *river, int river_s, char *loc, int loc_s, long int *err)
struct sqlca_s ifx_sqlca_t
fprintf(fp,"%d %d %d %d 1\n", iminx, iminy, maxi, maxj)
struct sqlca_s::sqlcaw_s sqlwarn