null_condition 

Syntax

<null_condition> ::= NULL [IF] <condition> | DEFAULT NULL

When the condition is evaluated, the shorter of the comparison values (value in the source file or the null) is filled with space characters.

A check is made before each line in the source file is loaded to see whether the condition formulated for the columns applies. If it does, the NULL value is inserted in this column. If not, the value from the assigned field in the source file is inserted.

Use

This is a syntax rule for describing columns.

Use it in a command for loading data to specify under which conditions the NULL value is to be loaded into a column of the target table.

You can use the DEFAULT-NULL condition if the NULL value in the source file is represented in the same way for all columns that you want to load from the target table. The character string that you need to specify after NULL IF POS is only specified once as file option NULL in the DEFAULT-NULL condition.

You cannot load columns defined as key columns (KEY) or NOT NULL with the NULL value. If you do, the table load action terminates with an appropriate error message.

If, when you created the table in the database, you defined a default other than NULL for columns, you cannot load NULL values into the columns. If this is the case, the Replication Manager uses the default defined for the column instead of the NULL value.

You want to load the data from the source file article.data into the database. You want to load the NULL value into some columns of the target table. Define a separate condition for each of these columns. The NULL value is entered if this condition is met.

DATALOAD TABLE article
  foa       01-08
  des       09-39         NULL IF POS 09-11 = '   '
  stock    40-43 INTEGER NULL IF POS 40-43 INTEGER < '0'
  min_ord   44-45 INTEGER
  price     46-53 DECIMAL (2) NULL IF POS 1 <> 'X'
                                  OR POS 46-53 DECIMAL < '0'
  weight   54-57 REAL
INFILE 'article.data' FORMATTED

You want to load the data from the source file article.data into the database. You want to load the NULL value into some columns of the target table. The same '?' representation of the NULL value applies to all columns in the command where DEFAULT NULL is specified.

DATALOAD TABLE article
  foa       01-08
  des       09-39 DEFAULT NULL
  stock    40-43 INTEGER DEFAULT NULL
  min_ord   44-45 INTEGER
  price     46-53 DECIMAL (2) DEFAULT NULL
  weight    54-57 REAL
INFILE 'article.data' FORMATTED
NULL '?'