Null handling for CHAR + nullable field

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
anton
Premium Member
Premium Member
Posts: 20
Joined: Wed Jul 19, 2006 9:32 am

Null handling for CHAR + nullable field

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Show us the warnings.
-craig

"You can never have too many knives" -- Logan Nine Fingers
anton
Premium Member
Premium Member
Posts: 20
Joined: Wed Jul 19, 2006 9:32 am

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What is the value of the Null Field Value property?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
anton
Premium Member
Premium Member
Posts: 20
Joined: Wed Jul 19, 2006 9:32 am

Post by anton »

Hi,

This is NULLABLE in target table(Teradata).

I haven't set any NULL filed property in schema file
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps that's a hint that you should. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post 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.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
anton
Premium Member
Premium Member
Posts: 20
Joined: Wed Jul 19, 2006 9:32 am

Post by anton »

We corrected SAP program to receive SPACE instead of blank.

Thank you everyone, appreciate your help
Post Reply