Previous
Topic:
Load Options: Specifying Indicators for NULL or "Empty" Values |
Next
Topic: Advanced Load Options: Verifying and Filtering Data with the PIC Clause |
Setting Up the Data Load with the Load Specification Script
Load Options: Specifying Portions
of the Input File for Processing
ndlm offers a number of options allowing for specification of portions of the input file to be loaded (or not). The following directives can be included before the record specification section in the load specification file, or the equivalent flags can be included in the ndlm invocation:
SKIPHEADER ('row-delimiter', n)
Instructs ndlm to skip the first n rows of an input file, where the end of each row is indicated by the specified row-delimiter character(s) in single quotes.Note:
If the SKIPHEADER directive is included in the load script, it must appear before the rest of the options listed below.IGNORE n
Instructs ndlm to ignore the first n bytes in an input file. This processing flag performs the same function as (and may be overridden by) the -i invocation flag.SKIP n
Instructs ndlm to skip the first n records of an input file. This processing flag performs the same function as (and may be overridden by) the -s invocation flag.PROCESS n
Instructs ndlm to import only n records of the input file. This processing flag performs the same function as (and may be overridden by) the -p invocation flag.
These directives can be used together. For example, specifying SKIP 1000
PROCESS 5000 instructs ndlm to load records 1001 to 6000.
The SKIPIF Clause
The SKIPIF clause allows you to specify conditions under which a record should not be loaded into the database, but rather written to a special file. The SKIPIF clause appears immediately after the record specification section, and has the following general format:
SKIPIF field-label <conditional expression> @skip-file-name.skp
As with the NULLIF/MISSINGIF clauses, the conditional expression can be any valid NDL++ expression. Multiple SKIPIF clauses can be included in a load specification script, with each set of skipped rows being written to a separate file. If only one SKIPIF clause is included, the @skip-file-name.skp portion can be omitted: the skipped records will be written by default to a file with the same name as the load specification file and the extension .skp.
Example
In the following example, ndlm will skip any row in which the contents of field2 is "0000ZZZZZZZZ000".
IMPORT @sample.dat
{
RECORD
{
field1 (15)
field2 (15)\n
}
SKIPIF field2 == '0000ZZZZZZZZ000' @sample_load.skp
schema1.table1
{
column1 field1
column2 field2
}}
Previous
Topic:
Load Options: Specifying Indicators for NULL or "Empty" Values |
Next
Topic: Advanced Load Options: Verifying and Filtering Data with the PIC Clause |