SQL Language Guide : 8. SQL Statements : INCLUDE
 
Share this page                  
INCLUDE
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.
The file specified by the 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.
Incorrect:
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 default extension of your host language is assumed.
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:
INCLUDE SQLCA - Includes the SQL Communications Area.
INCLUDE SQLDA - Includes the definitions associated with the SQL Descriptor Area.
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.
Permissions
This statement is available to all users.
Related Statements
DECLARE