SAND CDBMS Tools Reference Guide
Data Loader (ndlm)

 

Previous Topic:
Declaring Variables in NDL++ Scripts
Chapter Index
Next Topic:
Import Examples

 

The #INCLUDE Directive


Rather than having to rewrite or copy/paste NDL++ script portions that are used frequently, you can use #INCLUDE directives to incorporate these script portions in the specification file. An #INCLUDE directive references an external text file that stores the desired script; when ndlm encounters the #INCLUDE directive during a load operation, the contents of the referenced file are dynamically inserted into the specification file at the location where the #INCLUDE directive was found.


Using the Directive

The #INCLUDE keyword is followed by whitespace, the @ symbol, and the name of the file to be included, or the file path and name if the file is not in the current execution directory. For instance:

#INCLUDE @script1.inc

-or-

#INCLUDE @C:\ndl_scripts\script1.inc

The #INCLUDE directive can appear anywhere in the specification file. When the specification file is interpreted by ndlm at load time, each instance of the #INCLUDE directive will be replaced with its associated file script text. Where used, the #INCLUDE directive must be the only entry on the line.


Example

In this table section example, the directive is used to reference NDL++ functions that are contained in file1.inc and file2.inc. These functions are then used to manipulate mycol1 and mycol2.

mytable
{
mycol1
#INCLUDE @file1.inc
mycol2
#INCLUDE @file2.inc
}