Null handling flat 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

Post Reply
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Null handling flat file

Post by mmanes »

how do I handle null fields when I read a flat file?
When I read, discard the records.

thank you in advance
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

Re: Null handling flat file

Post by G.K.K »

Use NullFieldValue='' under field properties in formattab of sequential file stage.

Thanks
G.K.K
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

to all types of field?
G.K.K
Participant
Posts: 61
Joined: Tue May 13, 2008 6:54 am

Post by G.K.K »

yes.. provide scenarios if u have any special cases
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

it's not valid for all types (timestamp,decimal, etc...)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Null handling flat file

Post by chulett »

mmanes wrote:When I read, discard the records.
You want them discarded or they are being discarded and you want to process them as nulls?
-craig

"You can never have too many knives" -- Logan Nine Fingers
mmanes
Participant
Posts: 91
Joined: Tue Mar 16, 2004 10:20 am
Location: Rome

Post by mmanes »

are being discarded and I want to process them as nulls.
gaurav_shukla
Participant
Posts: 12
Joined: Wed Jun 13, 2007 2:12 am

Post by gaurav_shukla »

Use NullFieldvalue property of Sequential stage.

Check format/metadata of your source file, whatever value you get as Null from file for any data type use that value in NullFieldvalue.

For example it could be -

String -NullFieldvalue=''
Decimal - NullFieldvalue=0
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Post by srinivas.nettalam »

gaurav_shukla wrote:Use NullFieldvalue property of Sequential stage.

Decimal - NullFieldvalue=0
0 (Zero) might actually be a valid value for a number field.There is no "NULL" in a file and it is empty that actually is populated in a file and hence NullFieldValue='' works fine in common.
N.Srinivas
India.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Text files don't have data types, they only have text. Technically, they can not have NULL. Therefore, all you have to do is to set the NullFieldValue property to the value that represents NULL in each field. And that's a business decision.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply