Previous Topic: SQLWA - DB2 Format (Assembler)Next Topic: Error Handling


SQLWA - Format for C Language

Following is an example SQL Work Area (SQLWA) for the C language.

 struct SQLwa
 {
   char     eye_catch[8];
   int      len;
   char     command[5];
   unsigned char flags;
   char     filler[2];
   char     proc_name[8];
   int      stamp;
   int      stmt_id;
   char    *addr_host_desc;
   char     end_catch[8];
 } sqlwa = {"SQLWA***", 48,"QEXEC", 0,
            "  ", "", 70488250, 0, 0, "ENDSQLWA"};
struct
 {
   int       len;
   short     nbr_ent;
   char        filler[2];
   struct sqlhvar
   {
     short   type;
     short   len;
     void   *data;
     short  *ind;
     char    dir;
     char    filr[3];
   } var[n];
 } sqlHost;
 char host_var_end[6] = "VAREND";

Note: The n in var[n] appears as a number that has a special purpose, that is, it corresponds to the maximum number of host variables needed by statements in the program.