Page 1 of 1

Null handling for CHAR + nullable field

Posted: Mon Feb 08, 2016 9:43 am
by anton
Hi,

I am reading pipe delimited file and loading data to Teradata by parsing data through schema file. (Generic job)

The job is failing with warnings, The input looks like below. (No NULL, No Space)

AAA||BBB|C|C
BBB||CCC|D|E

At target the datatype is CHAR(1) NULLABLE.

When I parse data through schema file for the second field, the job generates warnings.

I have tried adding APT_STRING_PAD_CHAR environment variable with values 0x0 and 0x20, but doesn't seem to be working.

PARAS: NULLABLE string[1];

Please help me to resolve this issue.

Posted: Mon Feb 08, 2016 10:24 am
by chulett
Show us the warnings.

Posted: Mon Feb 08, 2016 10:39 am
by anton
Hi Craig,

Here is the warning.

sf_InterimFile,0: Field "PARAS" delimiter not seen, at offset: 5

If i change schema file to varchar(1) it is working fine.

Posted: Mon Feb 08, 2016 4:39 pm
by ray.wurlod
What is the value of the Null Field Value property?

Posted: Tue Feb 09, 2016 3:13 am
by anton
Hi,

This is NULLABLE in target table(Teradata).

I haven't set any NULL filed property in schema file

Posted: Tue Feb 09, 2016 8:50 am
by chulett
Perhaps that's a hint that you should. :wink:

Posted: Tue Feb 09, 2016 11:10 am
by asorrell
Anton - a CHAR field is fixed length. It can only be either NULL or a specific number of characters. In this case, since it is CHAR(1), it is scarfing up one of your delimiters as data, throwing everything else off.

In this case, if the data supplier is using the empty string ("") to represent NULL, then what Ray/Craig are saying is that you have to specify that in the schema for the file. There is no default definition, since technically NULL is more of a database concept.

Posted: Tue Feb 09, 2016 4:20 pm
by ray.wurlod
Augmenting what Andy said, DataStage requires that the Null Field Value have the same length as a Char data type field. You can get around this by declaring it to be VarChar, and sorting it out afterwards.

Posted: Thu Feb 11, 2016 11:34 pm
by anton
We corrected SAP program to receive SPACE instead of blank.

Thank you everyone, appreciate your help