User Tools

Site Tools

Navigation:  Language Reference > 2 - Program Source Code Format > Compiler Directives >====== INCLUDE (compile code in another file) ====== Previous pageReturn to chapter overviewNext page

INCLUDE(filename [,section]) [,ONCE]


INCLUDE Specifies source code to be compiled which exists in a separate file which is not a MEMBER module.
filename A string constant that contains the DOS file specification for a source file. If the extension is omitted, .CLW is assumed.
section A string constant which is the string parameter of the SECTION directive marking the beginning of the source code to be included.
ONCE The ONCE attribute precludes any INCLUDEd data from being compiled more than once, which can result in compile warnings or errors. Regarding the use of the section attribute, ONCE is applied on the entire filename, so subsequent uses of INCLUDE( filename, section ) will be ignored.

The INCLUDE directive specifies source code to be compiled which exists in a separate file which is not a MEMBER module. Starting on the line of the INCLUDE directive, the source file, or the specified section of that file, is compiled as if it appeared in sequence within the source module being compiled. You can nest INCLUDEs up to 3 deep, so you can INCLUDE a file that includes a file that includes a file but that latter file must not include anything.

The compiler uses the Redirection file (CurrentReleaseName.RED) to find the file, searching the path specified for that type of filename (usually by extension). This makes it unnecessary to provide a complete path in the filename to be included. A discussion of the Redirection file is in the User's Guide and the Project System chapter of the Programmer's Guide.


GenLedger PROCEDURE         !Declare procedure

INCLUDE('filedefs.clw')    !Include file definitions here

CODE                       !Begin code section

INCLUDE('Setups','ChkErr') !Include error check from setups.clw

See Also:



include_compile_code_in_another_file_.htm.txt · Last modified: 2021/04/15 15:57 by