Null handling in schema file

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

Nagin
Charter Member
Charter Member
Posts: 89
Joined: Thu Jan 26, 2006 12:37 pm

Post by Nagin »

If I remove nullable property for Col_One, that row is getting rejected if it has null. Again, Col_one is integer.

So, If I pass in a null or a string in Col_one it is rejecting successfully. I am just getting a warning in the log saying that import error and no default value.

Samething does not work for a string filed. If I pass in 123 in the string field it does not reject, probably because the number is read in as a string as this is a flat file. But for nulls, the row is not getting rejected
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

String field accepts both numbers and alphabets. If you want to reject records containing numbers then use Num() as constraint
You are the creator of your destiny - Swami Vivekananda
Nagin
Charter Member
Charter Member
Posts: 89
Joined: Thu Jan 26, 2006 12:37 pm

Post by Nagin »

No, I am okay with String field accepting numbers. Are you saying we can use Num() in the schema file ?

Still the main purpose is I need to reject null strings at source schema file level
Nagin
Charter Member
Charter Member
Posts: 89
Joined: Thu Jan 26, 2006 12:37 pm

Post by Nagin »

Gregg,
greggknight wrote: BEFORE_COMPANY:nullable string {null_field=''};

BEFORE_FACDIVN:nullable string {null_field=''};
Looks like this works for strings that are nullable. How can I reject strings coming in as null but are not nullable
Nagin
Charter Member
Charter Member
Posts: 89
Joined: Thu Jan 26, 2006 12:37 pm

Post by Nagin »

I found a work around, I had to add a filter stage after the sequential file stage and specify the where condition is not null for each of the not nullable columns.

Ofcourse, this works as I know the not nullable column names. But for a truely dynamic metadata scenario I don't know how this would work. This is probably one of those things that Datastage has a problem to deal with.

Thank you all for the help.
Post Reply