Valid in: ESQL
The Include statement incorporates external files into your program's source code.
The Include statement has the following format:
EXEC SQL INCLUDE filename | SQLCA | SQLDA;
The Include statement is typically used to include variable declarations, although it is not restricted to such use. When used to include variable declarations, it must be inside an embedded SQL declaration section.
Note: The file generated by dclgen must be specified using the include statement. For details about dclgen, see the Embedded SQL Companion Guide.
The file specified by the SQL include statement must contain complete statements or declarations. For example, it is illegal to use include in the following manner, where the file, predicate, contains a common predicate for select statements:
exec sql select ename
from employee
where
exec sql include 'predicate';
Filename must be a quoted string constant specifying a file name or a logical or environment variable that contains a file name. If a file name is specified without an extension, the DBMS Server assumes the default extension of your host language.
The specified file can contain declarations, host language statements, embedded SQL statements, and nested includes. When the original source file is preprocessed, the include statement is replaced by a host language include directive, and the included file is also preprocessed.
There are two special instances of the include statement:
Both these statements must be placed outside all declaration sections, preferably at the start of the program. The statement must be terminated as required by the rules of your host language.
All users are permitted to use this statement.
The following are Include statement examples:
exec sql include sqlca;
exec sql begin declare section;
exec sql include 'global.var';
exec sql end declare section;