In Datastage C++ varchar is Null, how to handle gracefully?
Hi,
I am trying to execute the C++ program from the DataStage client. I was getting the following error message.
buildop_200,8: Fatal Error: Null value on the accessor interfacing to field "field1".
Looks like it was receiving the Null values in the coulmn 'field1' from the input file. Even though i am handling the NULL check in my buildop c++ code, it’s still failing when i am running this buildop (C++ code) through the DataStage job.
How to handle NULL values (if column value [c++ varchar/string] is null) gracefully in the Datastage?
This is what I am currently handling in the code….
Code:
if (in0.field1[1] == 0 || in0.field1[1] == '\0' || in.field1[1] == ' ') /*** NULL check ****/
{
//C++ logic
}
else
{
if ((in0.field1[1] == 'N') && (in0.field2.substring(1, 2) == in0.Orig_Code))
{
//C++ logic
}
// More C++ logic, if statements
}
Could you please help me with this problem? I apprecite your help in this regard.
Thanks,