Incorporates text from other files into the current source file during compilation.
%INCLUDE filename[,filename]…;
The specified filename is used to locate a text file whose content is inserted into the program text in place of the %INCLUDE statement.
%INCLUDE 'FILE1.IN','FILE2.IN','FILE3.IN'; %INCLUDE FILE4,'FILE5',(FILE6),(FILE7); %INCLUDE 'TOTAL.IN';
In the previous examples, the contents of the files referenced by FILEn, and so on, and by 'TOTAL.IN' will be copied into the current file at compile time.
DECLARE I %INCLUDE 'FDCL.IN'; STATIC INITIAL (0);
Assuming that the file referenced by ' FDCL.IN ' contains the single line FIXED BINARY (31) , this example is equivalent to the following:
DECLARE I FIXED BINARY (31) STATIC INITIAL (0);
None.
Description
The %INCLUDE statement incorporates text from other files into the current source file during compilation.
The %INCLUDE statement can appear in place of a name, constant, or punctuation symbol. The included text may contain additional %INCLUDE statements. %INCLUDE statements normally contain declarations that are common to more than one program module.
Open PL/I searches for a file to satisfy the %INCLUDE statement according to the following rules. (See the section Compiler Options in the chapter Using Open PL/I in your Open PL/I User's Guide).
In the following rules, we use the term "absolute directory path" for a path specifier beginning with a slash (/), such as /tmp/inc, and "relative directory path" for other path specifiers, such as sys/ or .. /.
It may also contain a directory path, as in,
In this case, with the filename not in quotes, Open PL/I first searches for the file with filename in uppercase characters; that is, FILENAME. If that search fails, Open PL/I tries again using lowercase letters.