SQL/MP Programming Manual for C

Host Variables
HP NonStop SQL/MP Programming Manual for C429847-008
2-2
Coding Host Variable Names
Place a Declare Section with the C variable declarations. You can specify more
than one Declare Section in a program, if necessary, but you cannot nest Declare
Sections.
Do not place a Declare Section within a C structure declaration.
Specify the C #include directive in a Declare Section to copy declarations from
another file. However, do not use the SQL SOURCE directive.
Use either C or SQL comment statements in a Declare Section.
Coding Host Variable Names
Use C naming conventions for your host variable and indicator variable names.
A name can contain from 1 to 31 alphanumeric characters, including the underscore
(_), and must begin with a letter or an underscore. To avoid conflicts with HP names,
do not begin your names with two underscores or end them with one underscore. This
example uses a Declare Section with host variable names:
EXEC SQL BEGIN DECLARE SECTION;
short order_number; /* simple variables */
char host_var_for_sql_statement;
struct employee /* structure */
{
short empnum;
char first_name[16];
union {
char last_name[21];
char name_code_item[3];
} union_last_name;
short deptnum;
short jobcode;
} employee_info;
int *ptr_to_table; /* pointer */
#include copyfile /* copy file */
EXEC SQL END DECLARE SECTION;