To include an external file into your embedded SQL program, use:
EXEC SQL INCLUDE filename END-EXEC. EXEC SQL INCLUDE <filename> END-EXEC. EXEC SQL INCLUDE "filename" END-EXEC.
The embedded SQL preprocessor will look for a file named filename.pco, preprocess it, and include it in the resulting COBOL output. Thus, embedded SQL statements in the included file are handled correctly.
By default, the ecobpg preprocessor will search a file at the current directory. This behavior can be changed by the ecobpg commandline option.
First, the preprocessor tries to locate a file by specified file name at the current directory. If it fails and the file name does not end with .pco, the preprocessor also tries to locate a file with the suffix at the same directory.
The difference between EXEC SQL INCLUDE and COPY statement is whether precompiler processes embedded SQLs in the file, or not. If the file contains embedded SQLs, use EXEC SQL INCLUDE.
Note
The include file name is case-sensitive, even though the rest of the EXEC SQL INCLUDE command follows the normal SQL case-sensitivity rules.