Was this helpful?
Include File Processing
The EQUEL include statement provides a means to include external files in your program's source code. Its syntax is:
## include filename
Filename is a quoted string constant specifying a file name, or a logical name that points to the file name. You must use the default extension ".qp" on names of include files, unless you override this requirement by specifying a different extension with the -n flag of the eqp command.
This statement is normally used to include variable declarations, although it is not restricted to such use. For more details on the include statement, see the QUEL Reference Guide.
The included file is preprocessed and an output file with the same name but with the default output extension ".pas" is generated. You can override this default output extension with the -o.ext flag on the command line. The reference in the original source file to the included file is translated in the output file to the specified include output file. If the -o flag is used with no extension, no output file is generated for the include file. This is useful for program libraries that are using VMS MMS dependencies.
If you use both the -o.ext and the -o flags, then the preprocessor will generate the specified extension for the translated include statements in the program but will not generate new output files for the statements.
For example, assume that no overriding output extension was explicitly given on the command line. The EQUEL statement:
## include 'employee.qp'
is preprocessed to the Pascal statement:
% include 'employee.pas'
and the file "employee.qp" is translated into the Pascal file "employee.pas".
As another example, assume that a source file called "inputfile" contains the following include statement:
## include 'mydecls'
The name "mydecls" is defined as a system logical name pointing to the file "dra1:[headers]myvars.qp" by means of the following command at the DCL level:
$ define mydecls dra1:[headers]myvars.qp
Assume now that "inputfile" is preprocessed with the command:
$ eqp -o.h inputfile
The command line specifies ".h" as the output file extension for include files. As the file is preprocessed, the include statement shown earlier is translated into the Pascal statement:
% include 'dra1:[headers]myvars.h'
and the Pascal file "dra1:[headers]myvars.h" is generated as output for the original include file, "dra1:[headers]myvars.qp".
For including source code using the include inline statement, see the QUEL Reference Guide.
You can also specify include files with a relative path. For example, if you preprocess the file "dra1:[mysource]myfile.qp," the EQUEL statement:
## include '[-.headers]myvars.qp'
is preprocessed to the Pascal statement:
%include '[-.headers]myvars.pas'
and the Pascal file "dra1:[headers]myvars.pas" is generated as output for the original include file, "dra1:[headers]myvars.qp."
Including Source Code with Labels
Some EQUEL statements generate labels in the output code. If you include a file containing such statements, you must be careful to include the file only once in a given Pascal scope. Otherwise, you may find that the compiler later issues Pascal warning or error messages to the effect that the generated labels are multiply defined in that scope.
The statements that generate labels are the retrieve statement and all the EQUEL/FORMS block-type statements, such as display and unloadtable.
Last modified date: 11/28/2023