12. Report-Writer Statements : Report Setup Statements : .Include Statement--Import Files that Contain Report-Writer Code : Description
 
Share this page                  
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.