Nulls in Pipe delimited 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
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Nulls in Pipe delimited file

Post by patonp »

Simple question....

I need to generate a pipe delimited sequential file where NULLS are represented by having no data between two delimiters regardless of the data type.

For example, if I have three fields in a file definition, and only the first field has a value for a given record, this would be represented as:

test||

Can I do this on the parallel canvas?

Thanks!

Peter
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Sure you can. Do a Null check on the incoming record and if Null is found, change it to an empty character.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Post by patonp »

I was wondering about data types like dates or decimals. I don't seem to be able to represent these using the method you describe.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

They cannot be represented as empty characters. They have to be changed to string first and then filled with an empty space. If you would like to retain their type then put the appropriate value. Like say 0 for integer and 0.00 for Decimal (3,2).
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Post by patonp »

DSguru2B wrote:They cannot be represented as empty characters. .
Is there really no way to do this? I'd like to replace an existing process that produces an output file with NULL dates represented by adjacent delimiters rather than a substituted value representing NULL.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

They can be if you make the target as varchar.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you set the Null Field Value property to "" you will get adjacent delimiters in your output file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Post by patonp »

ray.wurlod wrote:If you set the Null Field Value property to "" you will get adjacent delimiters in your output file.
This only seems to work for certain datatypes. What if my inbound delimited source file represents Null dates using adjacent delimiters? When I set the Null Field Value to "", I receive an error stating "A fixed length field cannot have a "null_field" of length 0 on import".
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

True. But someone had already posted that you can specify VarChar. Then all will be well. After all, there are no "real" data types in text files, only text.
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