Mapper
get_pos.c
Go to the documentation of this file.
1 #include "prototypes_new.h"
2 
3 char *get_pos(char *hb5)
4 
5 {
6 
7 EXEC SQL BEGIN DECLARE SECTION;
8 char hb5i[10];
9 char basin[10];
10 EXEC SQL END DECLARE SECTION;
11 
12 int j;
13 
14 sprintf(hb5i,"%s*",hb5);
15 
16 EXEC SQL prepare selectseg from
17  "select segid
18  from fgroup_seg
19  where fgroupid matches '*_F' and
20  segid matches ?";
21 
22 if(sqlca.sqlcode < 0) {
23 
24  printf("informix1 error %d\n",sqlca.sqlcode);
25  exit(1);
26 
27  }
28 
29 EXEC SQL declare segcursor cursor for selectseg;
30 
31 if(sqlca.sqlcode < 0) {
32  printf("informix2 error %d\n",sqlca.sqlcode);
33  exit(1);
34 
35  }
36 
37 EXEC SQL open segcursor using :hb5i;
38 
39 if(sqlca.sqlcode < 0) {
40  printf("informix3 error %d\n",sqlca.sqlcode);
41  exit(1);
42 
43  }
44 
45 
46 j=0;
47 for(;;) {
48 
49  EXEC SQL fetch segcursor into :basin;
50 
51  if(sqlca.sqlcode < 0) {
52  printf("informix4 error %d\n",sqlca.sqlcode);
53  exit(1);
54 
55  }
56 
57  if(sqlca.sqlcode == 100)
58  break;
59 
60  j++;
61 
62  c[j]=basin[5];
63 
64 
65 }
66 
67 if(j==2) {
68 
69  if(c[0]=='L' && c[1]=='H')
70  basin[5]='L';
71 
72  else if(c[0]=='O' && c[1]=='H')
73  basin[5]='H';
74 
75  else if(c[0]=='H' && c[1]=='R')
76  basin[5]='R';
77 
78  else if(c[0]=='L' && c[1]=='O')
79  basin[5]='L';
80 
81  else
82  printf("could not resolve\n");
83 
84  }
85 
86 EXEC SQL close segcursor;
87 
88 return(&basin[5]);
89 
90 }
char * get_pos(char *hb5)
Definition: get_pos.c:3
struct sqlca_s sqlca
sprintf(fbuf,"/usr/mapper/nexrad/ngrid.%02d-%02d-%02d-%02d", year, month, day, hour)
printf("fbuf is %s\n", fbuf)
int j
Definition: mapp2h.h:48
struct Cur cursor[4]
Definition: mapper.c:134
long sqlcode
Definition: db.c:44