Help with Lookups

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
jmperezrus
Participant
Posts: 15
Joined: Wed Mar 29, 2006 1:55 am

Help with Lookups

Post by jmperezrus »

I am going nuts with this guys... your help will be much appreciated.

What is the output of a Lookup stage (parallel) if no results are found matching the input? If we select "View data" it appears like a "null" value for this field, or like a 0-length string. Obviously these are different but for "View data" the appear the same. So I decided to open the output file itself with Ultraedit.
My field is a Char10 and if I check the output file physically it is a 10 null characters (hex 00 00) string. However, the Isnull function returns 0 (which means false). How can this be??

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

Post by ray.wurlod »

The output depends on your "failed lookup" rule. Sounds like you are using Continue.

In this case, the failed lookup link's columns are all set to NULL. This may be further affected by whether the receiving link's column definition specifies nullable or not and, where applicable, what its Null Field Value property is set to.

What you are seeing is two things in combination. The default NULL representation of 0x00 (ASCII NULL) and the pad character (default value also 0x00) being used to pad a Char field.

Use APT_STRING_PADCHAR to override the default pad character, and specify a Null Field Value property the same length as the Char datatype.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jmperezrus
Participant
Posts: 15
Joined: Wed Mar 29, 2006 1:55 am

Post by jmperezrus »

Thanks for your post Ray.
I can't read the whole post though...

Anyway, I must use "Continue" in the lookup, cause I want to keep those registries.

What I actually get is a string with 10 null (00 00 hex) characters (the field is a char 10).

Any other ideas? Please...
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If you intend to check Null you can optionally use LEN(TRIM(Link.Column))=0 which will give you the desired result.
The "00 00 hex" is configurable in Datastage Adminstrator client in Environmental variable.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
jmperezrus
Participant
Posts: 15
Joined: Wed Mar 29, 2006 1:55 am

Post by jmperezrus »

Thanks Kumar.

I have actually tried that and the returned value for LEN is 10. I know, weird... My field has ten "00 00 hex" characters and its "LEN" is 10. Therefore I cannot distinguish valid registries from these null ones by using that function...
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

LEN should retun 10 but have you tried LEN(TRIM())?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
jmperezrus
Participant
Posts: 15
Joined: Wed Mar 29, 2006 1:55 am

Post by jmperezrus »

Yes, I did... Sorry I did not mention it. Result was 10...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

For less than US$1 per week you CAN read the whole post.
They do have to fund this site. Premium memberships contribute only a small proportion of the actual running cost.
Last edited by ray.wurlod on Tue Sep 05, 2006 4:50 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Assign APT_STRING_PADCHAR to a space ' '. As suggested by Ray.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
jmperezrus
Participant
Posts: 15
Joined: Wed Mar 29, 2006 1:55 am

Post by jmperezrus »

Thanks Kumar but I think that by doing that I could create problems with all the null handling I have done so far in the project...
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Hi

You can enable it by job level. You don't have to apply this to your entire project.
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
jmperezrus
Participant
Posts: 15
Joined: Wed Mar 29, 2006 1:55 am

Post by jmperezrus »

Thanks everyone for your posts...

I have finally created a routine that removes these null characters in-between strings by using Seq function...

Best regards
Jose
Post Reply