SAND CDBMS Tools Reference Guide
Data Loader (ndlm)

 

Previous Topic:
The NDL++ Data-Load Scripting Language
Chapter Index
Next Topic:
The #INCLUDE Directive

 

Declaring Variables in NDL++ Scripts


NDL++ supports the declaration of variables for use in any NDL++ statement. Variables are declared in a VAR section of the script, which appears before the RECORD section and after the TYPE section (if present), and can be used in any of the expressions that appear subsequently in the script. To call a variable in an NDL++ expression, precede the variable name with the percent sign (%).

The following considerations apply to the declaration and calling of variables in NDL++ scripts:


Variable Declaration Syntax

VAR
{
variable-name( <variable-definition> )
...
}


Example

input: first-name, last-name, limit, owing

IMPORT @sample.dat
{

TYPE
{
FLOAT field3,field4
}
VAR
{
V1(field1+field2)
V2(field3-field4)

}
RECORD
{
field1 *,
field2 *,
field3 *,
field4 *\r\n
}
finance.debtors
{
names (%V2<0)?(%V1):("Null")
}

}


Results:

Variable V1 concatenates the first-name and last-name fields; variable V2 subtracts owing from limit. This script uses a conditional expression to insert the full names of debtors who have surpassed their credit limit into the names column of the finance.debtors table.

 
Previous Topic:
The NDL++ Data-Load Scripting Language
Chapter Index
Next Topic:
The #INCLUDE Directive