INCLUDE Statement

Purpose

Reads and incorporates a file into the Net.Data macro in which the statement is specified.

Net.Data searches the directories specified in the INCLUDE_PATH statement in the initialization file to find the include file.

You can use include files the same way you can in most high-level languages. They can insert common headings and footings, define common sets of variables, or incorporate a common subroutine library of FUNCTION block definitions into a Net.Data macro.

Net.Data executes an INCLUDE statement only once when processing the macro and inserts the content of the included file at the location of the INCLUDE statement in the macro. Any variable references in the name of the included file are resolved at the time the INCLUDE statement is first executed, not when the content of the included file is to be executed.

When an INCLUDE statement is in a ROW or WHILE block, Net.Data does not repeatedly execute the INCLUDE statement. Net.Data executes the INCLUDE statement the first time it executes the ROW or WHILE block, incorporates the content of the included file into the block, and then repeatedly executes the ROW or WHILE block with the content of the included file.

Authorization Tip: Ensure that the user ID under which Net.Data executes has access rights to any files referenced by the INCLUDE statement. See the section on specifying Web server access rights to Net.Data files in the configuration chapter of Net.Data Administration and Programming Guide for more information.

Syntax

                  .-------------------------.
                  V                         |
>>-%INCLUDE----"----+-string-------------+--+---"--------------><
                    '-variable reference-'
 

Values

%INCLUDE
The keyword that indicates a file is to be read and incorporated into the Net.Data macro.

name
An alphabetic or numeric string beginning with an alphabetic character or underscore and containing any combination of alphabetic, numeric, or underscore characters.

string
Any sequence of alphabetic and numeric characters and punctuation, except the new-line character.

variable reference
Returns the value of a variable and is specified with $ and (). For example: if VAR='abc', then $(VAR) returns the value 'abc'. See Variable Reference for syntax information.

Context

The INCLUDE statement can be found in these contexts:

Restrictions

The INCLUDE statement can contain these elements:

Function calls in the string are not allowed.

You can nest up to ten INCLUDE statements.

Examples

Example 1: An INCLUDE statement in an HTML block

%HTML(start){
%INCLUDE "header.hti"
...
%}

Example 2: An INCLUDE statement in a REPORT block

%REPORT {
  %INCLUDE "report_header.txt"
  %ROW {
    %INCLUDE "row_include.txt"
  %}
  %INCLUDE "report_footer.txt"
%}

Example 3: Variable references in an INCLUDE statement

%define REMOTE_USER = %ENVVAR
%include "$(REMOTE_USER).hti"
 


[ Top of Page | Previous Page | Next Page | Index ]