SQL/MP Programming Manual for C
Host Variables
HP NonStop SQL/MP Programming Manual for C—429847-008
2-23
Using Indicator Variables With the INVOKE Directive
PREFIX and SUFFIX Clauses
The PREFIX and SUFFIX clauses cause INVOKE to generate an indicator variable
name derived from the column name and the prefix or suffix. This example shows an
INVOKE directive with the PREFIX and SUFFIX clauses as it appears in a C source
program:
EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL INVOKE ctable PREFIX beg_ SUFFIX _end;
EXEC SQL END DECLARE SECTION;
The C compiler generates this structure:
/* Record Definition for table \SYS.$DSK.PERSNL.CTABLE */
/* Definition current at 15:32:39 - 09/22/95 */
struct ctable_type {
short beg_znum_end;
long znum;
short beg_zchar_end;
char zchar[16];
};
NULL STRUCTURE Clause
The NULL STRUCTURE clause causes INVOKE to generate a structure for a column
that contains an indicator variable. The NULL STRUCTURE clause assigns the name
indicator to all indicator variables in the structure.
This example shows an INVOKE directive with the NULL STRUCTURE clause as it
appears in a C source program:
EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL INVOKE emptbl AS emptbl_rec NULL STRUCTURE;
...
EXEC SQL END DECLARE SECTION;
...
The C compiler generates this structure:
/* Record Definition for table \SYS.$VOL.SUBVOL.EMPTBL */
/* Definition current at 16:07:00 - 05/17/94 */
struct emptbl_rec {
unsigned short empnum;
struct {
short indicator;
char valu[16];
} first_name;
char last_name[21];
struct {
short indicator;
char valu[11];
} retire_date;
};