SQL/MP Programming Manual for C
Host Variables
HP NonStop SQL/MP Programming Manual for C—429847-008
2-24
Using INVOKE With SQLCI
Using INVOKE With SQLCI
You can also run the INVOKE directive interactively through SQLCI to create host
variable declarations in a copy file. For example, this INVOKE directive generates a C
copy file from the DEPT table:
>> INVOKE =dept FORMAT C TO copylib (deptrec);
...
Using INVOKE with SQLCI provides less program independence than embedding
INVOKE in your program, because you must re-create the host variable declarations if
the referenced table changes. However, when necessary, you can edit the host
variables before copying them into your program’s compilation unit.
Use the #include directive, not the SQL SOURCE directive to copy the host variable
declarations in your program’s compilation unit.
Associating a Character Set With a Host
Variable
By default, NonStop SQL/MP associates a single-byte character set with a host
variable. To associate a specific character set such as Kanji or KSC5601 with a host
variable, include the CHARACTER SET clause in the host variable declaration using
this syntax:
CHARACTER SET [ IS ]
are keywords that must precede the character set name. You must specify the
CHARACTER SET clause in uppercase letters. If you omit the clause, the
character set defaults to UNKNOWN.
charset
is the character set name, which must be one of these keywords (in uppercase
letters): ISO8859n (n ranges from 1 through 9), KANJI, KSC5601, or UNKNOWN.
The UNKNOWN keyword indicates an unknown single-byte character set and is
equivalent to omitting the CHARACTER SET clause.
hostvar
is the name of the host variable, which must follow the naming conventions for a
C identifier.
length
is the length in characters (not bytes) of the host variable. length must also
include an extra byte for the null terminator, if the SQL pragma specifies the
CHAR_AS_STRING option (the default).
char [ CHARACTER SET [ IS ] charset ] hostvar [ length ]
Note. NonStop SQL/MP does not support the C wchar_t data type.