SAND CDBMS Tools Reference Guide
Data Loader (ndlm)

 

Previous Topic:
The NULLIF and MISSINGIF Statements
Chapter Index
Next Topic:
Import Map Specification

 

The SKIPIF Clause


The SKIPIF keyword, placed immediately after the RECORD section of the load specification script, instructs ndlm to skip a record when one ore more specific conditions are met, and place the skipped records in designated file(s). The syntax of the SKIPIF clause is as follows:

[ SKIPIF
{
  [ {<logical expression> @skipfile-name}... ]
  <logical expression> [ @skipfile-name ]
} ]

The <logical expression> argument can be any valid NDL++ expression, using functions, variables, field references, or constants. For each record where the specified condition evaluates to TRUE, the record will be written to a file instead of being loaded. Note that when a comparison value is a constant, whether numeric or alphabetic, this value must be enclosed by single quotes ( ' ). For detailed information about NDL++ variables and functions, consult the appropriate sections below.

When multiple conditions are specified, they must all be enclosed by curly brackets { }. If there is only one SKIPIF condition, the brackets are optional.

If no name for the skip file is defined by the user, SAND CDBMS assigns it a default name consisting of the name of the load specification file, with the .skp extension. However, when more than one SKIPIF condition is defined, a file name must be included for each (except for the last SKIPIF condition in a series, which will write by default to the spec-file.skp file if no other file is specified). The skip file names can all be the same, in which case all skipped records will be written to this one file; or, if the designated skip files are different, each skip file will contain only those records for which the specific condition was true. Note that the same record could be written to more than one skip file if the record satisfies multiple conditions that have distinct skip files.


Example

In the following example, where the specification file is named "sample.ndl", ndlm will skip each row in which any one of these conditions is true and write the record to the designated file:

IMPORT @sample.dat
{

RECORD
{
field1 (1:15)
field2 (16:15)\r\n
field3 (field2:1:8)
}
SKIPIF
{
field3 == '
0000ZZZZZZZZ000' @sample_load.skp
InStr(field1, 'Abc', 0) >= 5 ||
   ((InStrRev(field1, 'DEF', 0) <= 3) &&
    (InStrRev(field1, 'DEF', 0) > 0)) @sample_load.skp

isnull(field2)
}
schema1.table1

{
column1 field1
column2 field2
}

}