Including files and directories

The include statement is essentially the same as the COBOL COPY command, except that file search and copy occur at precompile time. At precompile time, include searches for the file in the directory or directories specified in the precompile statement. See the Open Client and Open Server Programmer’s Supplement for details about using the precompile statement and the COBOL compiler in your environment.

You can use the Embedded SQL include statement to add any source code file to your application, such as common data definitions, just as you use the COBOL COPY command. Hence, the following example is valid:

exec sql include "myfile" end-exec.

The precompiler changes include statements into COBOL COPY commands, surrounding the file name with quotation marks.

You can also set a precompiler command option to specify an include file directory. At precompile time, the precompiler searches the path specified in the COBOL compile command. When you specify a directory using this option, the precompiler adds the directory to the file name and encloses the entire path name in quotation marks. The file’s path is then hard-coded into the target program. See the Open Client and Open Server Programmer’s Supplement for details.