replace null to string in a sequential file

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
dsquestion
Participant
Posts: 26
Joined: Thu Feb 03, 2005 1:05 am

replace null to string in a sequential file

Post by dsquestion »

Hi All,

I am using sequential file as my source I just want to assign null values to ? .I just want to do this in the sequential file itself I dont want to handle this in the transformer by mentioning if isnull(column.name) then "?" else column.name.I have tried for null string in the sequential cloumn defintion but I didnt get it.Is there any possiblity.Please do help me.

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

Post by ray.wurlod »

There are no nulls in sequential files.

Therefore the Format tab in a Sequential File stage allows you to specify how null is represented. By default a zero length string is interpreted as null. In the Columns grid you can specify a different representation of null for each particular column. But this does NOT perform any conversion.

Conversion - in a server job - must be performed in a Transformer stage with an expression such as

Code: Select all

If IsNull(InLink.TheColumn) Then "?" Else InLink.TheColumn
A separate transformation is required for each column.

If you're going to do a lot of these, create a Transform similar to the supplied null-handling Transforms such as NullToZero and NullToEmpty.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsquestion
Participant
Posts: 26
Joined: Thu Feb 03, 2005 1:05 am

Post by dsquestion »

Hi Ray,

Thanks for your reply.Your reply was helpful.You are great.
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

dsquestion wrote:Hi Ray,
Thanks for your reply.Your reply was helpful.You are great.
As Craig points out below, I misinterpreted Ray's answer, but here is a more full explanation of NULL strings in sequential files.

If the input to a sequential file stage has a "Default NULL string:" value of ? in the Format tab, then @NULL will be written out as a ? character. Likewise if the output of the sequential file has ? as the null representation, then any field that has a value of ? or "?" will be interpreted as @NULL. No code is required in a transformer to do this.

You say that you have NULL values in a sequential file. As Ray points out, there are no NULLs in sequential files, only representations of null which by default is an empty string. What do your NULL source values look like?

Phil Hibbs.
Last edited by PhilHibbs on Tue Sep 20, 2005 7:57 am, edited 2 times in total.
Phil Hibbs | Capgemini
Technical Consultant
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I think you'll find that Ray's answer is based strictly on the OP's question regarding using a sequential file stage as a source in a job. The game plays out differently (as you noted) when using one as a target.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply