How are empty fields better handled

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
Nsg
Premium Member
Premium Member
Posts: 37
Joined: Thu Jan 26, 2006 1:21 pm

How are empty fields better handled

Post by Nsg »

Hi all,

While formating fields for my target seqencial file, I came up with multiple ways of handling fields that are empty and passing default values for those fields.
Following are the ways I thought of, but am not sure if DataStage interprets them the same way and if all ways are equally effecient (or otherwise)

1) Extract those fields as Character and non nullable and thus it passes 'spaces' for fields that are empty and then in transformer do and "If ' ' Then '9999' Else <Field_Value>"

2) Extract all fields as Varchar and nullable and then using NullToValue(<Field_Value>, '9999') in transformer.

Please let me know if any one of this is a preffered method over other?

Thanks,
nsg
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Neither is preferred, though I suspect the VarChar one may be slightly more efficient.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
djbarham
Participant
Posts: 34
Joined: Wed May 07, 2003 4:39 pm
Location: Brisbane, Australia

Re: How are empty fields better handled

Post by djbarham »

If the source is a database, then I'd make the input match the database specification which probably means varchar and nullable.

The way I see it, you have 2 choices, but they relate to how you output the data.

You sequential file stage has built in capability to handle nulls. You can use this.

Alternatively, you can simply use NullToValue(inputfield , defaultvalue) in your transformer stage.

I have tended to use the latter because I was too lazy to get my head around how the sequential file stage handles nulls.
Post Reply