Was this helpful?
.Include Statement--Import Files that Contain Report-Writer Code
Imports Report-Writer code residing in more than one file when the report is saved.
The .include statement has the following format:
.include filename
The parameter for the .include statement is as follows:
filename
The name of a text file containing a Report-Writer construct to be included in a report. If necessary, specify the full path name for the file. If you do not explicitly specify an extension for the file, the system assumes ".rw" as the default extension.
Description
Use the optional .include statement to specify one or more files containing Report-Writer code to be imported into the command text file. By using this statement, you can avoid retyping commonly used constructs that you need in more than one of your reports. You can nest .include statements within an .include statement.
Because Report-Writer constructs do not have to appear in any particular order, the .include statement can appear anywhere within Report-Writer code. However, the .name statement must still be the first statement in your specification.
Report-Writer incorporates the contents of the file specified in an .include statement each time you execute the sreport command to save your report specification. This means that when you update included files, the report specifications that include those files must be saved again using sreport to incorporate the changes. As Report-Writer executes sreport, it displays a message notifying you of each file that is included in your specification. This message can help diagnose report errors if any should occur.
VMS: If you give the full path name for a file, enclose the name in single quotes. If it is the name of a file in the current directory, no quotes are needed.
The following rules apply to the .include section:
The .include statements cannot contain variables. This is because variables are only available at runtime and Report-Writer only executes .include statements when you save the report specification with the sreport command (rather than when the report is executed with the report command).
An included file can contain more than one statement. However, a single Report-Writer statement must be contained completely within one file. You cannot use .include statements in the middle of another Report-Writer statement.
Within an .include file, you can have nested .include statements.
The maximum number of nested .include statements permitted is based on the number of open files allowed in your system.
A corresponding .if ‑.then‑.else[if] ‑.endif statement must all be contained in the same .include file, but statements following the condition can be other .include statements.
Examples
1. Include a file in current directory.
.include otherrep.rw
2. Include a file name with full path name.
Windows:
include \direct\subdirect\otherrep.rw
UNIX:
.include /direct/subdirect/otherrep.rw
VMS:
.include '[direct.subdirect]otherrep.rw'
Last modified date: 08/28/2024