fixed width columns and the default null string

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
hiltsmi
Participant
Posts: 20
Joined: Thu Aug 04, 2005 9:03 am

fixed width columns and the default null string

Post by hiltsmi »

I am receiving fixed width files.

I would like to determine when a column value is null.

On the sequential file stage - outputs - format screen there is a field called "default null string".

Can someone explain how this is supposed to be used? My assumption was that if I put a value there and an incoming field has that value Ascential would treat it like a null. Is this correct?

I put in a value like "*" and I get the following error when I compile.

External null string '*' (1 bytes) is too wide for column c1 (0 bytes).

Which makes no sense.
kris
Participant
Posts: 160
Joined: Tue Dec 09, 2003 2:45 pm
Location: virginia, usa

Re: fixed width columns and the default null string

Post by kris »

hiltsmi wrote:I am receiving fixed width files.

I would like to determine when a column value is null.

On the sequential file stage - outputs - format screen there is a field called "default null string".

Can someone explain how this is supposed to be used? My assumption was that if I put a value there and an incoming field has that value Ascential would treat it like a null. Is this correct?

I put in a value like "*" and I get the following error when I compile.

External null string '*' (1 bytes) is too wide for column c1 (0 bytes).

Which makes no sense.
When you are reading the fixed width file and want to determine if the column value is null, then trim(link.column) and check for the empty string in the transformer.

Code: Select all

trim(link.column)=''
default NULL string is used when you have SQL null in the data. You should not expect any SQL nulls in when reading fixed width file.

Kris~
~Kris
hiltsmi
Participant
Posts: 20
Joined: Thu Aug 04, 2005 9:03 am

Post by hiltsmi »

In this case an empty string and NULL are not the same thing. An empty string indicates no data was entered into the field but null indicates the data is unknown.
kris
Participant
Posts: 160
Joined: Tue Dec 09, 2003 2:45 pm
Location: virginia, usa

Post by kris »

hiltsmi wrote:In this case an empty string and NULL are not the same thing. An empty string indicates no data was entered into the field but null indicates the data is unknown.
Thats true.

Depending where the data is(database, files) and where we are checking, both empty string and NULL are different.

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

Post by ray.wurlod »

Because you're using fixed width, the representation of NULL will differ in different columns (since it has to be the same width as the column). In the Columns grid you can specify column-specific representations of NULL; scroll right until you find it.
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