ESQL/C & structures
Posted in 1998
Topics: Performance & Tuning, Connectivity: ESQL/C, 4GL & Embedded SQL
In ESQL/C, is it possible to create a global structure (no instances on
creation) as a host variable and the define instances, also as host
variables later? Here is my problem:
Step 1:
#include <stdio.h>
$ include sqlca;
$ struct test_struc
{
char first_name[16];
char last_name[21];
}; /*<--- line 8*/
void main()
{
$ struct test_struc inst_1; /*<--line 12*/
.
.
.
}
This compiles (esql -o test2 test2.ec) with the following error:
line 8: syntax error on keyword or symbol ';'.
No problems with line 12, though.
Step 2:
#include <stdio.h>
$ include sqlca;
$ struct test_struc
{
char first_name[16];
char last_name[21];
} holdinst; /*<--- line 8 Added "holding" instance*/
void main()
{
$ struct test_struc inst_1; /*<--line 12*/
.
.
.
}
This compiles, skips the line 8 error, but gives the following:
line 12: error: incomplete struct/union/enum inst_1: inst_1.
My environment is SE 2.1x with ESQL 2.1 (pretty old, huh!).
I'm not sure if I am just missing something easy or, perhaps, creating an
instance of a structure (as a host var) at a later point is not possible.
Doing the same program without host variables works fine. Any ideas or
help is greatly appreciated.
Matt Johnson
Teleperformance USA