Validating records using Key Expression in transformer

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
babbu9
Premium Member
Premium Member
Posts: 75
Joined: Tue Jun 01, 2004 9:44 am

Validating records using Key Expression in transformer

Post by babbu9 »

Hi
I am having a problem implementing a logic. I have a fixed width flat file which has Customer, Account,Group and Product IDs (all characters) as columns.
Firstly I would like to reject all records which have any of these values as Null.
Secondly I have to see that a concatenation of these 4 values already exists in a database and continue processing the record only if its present.
Ex: Customer1+Account1+Group1+ProductID1 is present in the database then only pass the record for further processing else reject it.

I have tried defining 4 values as keys in hash file (loading data from database) to do a equijoin in transformer, but that does n't seem to be working.

I have tried many different ways to execute the logic, but both cases seem to be failing in the job.

I would really appreciate if anyone could explain how to do this for me.

DESIGN
Database
|
hashfile
|
V
Tx------------->database
^
|
|
flatfile


Thanks
Bob[/img]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Your design as sketched is OK, but we can't see the stage and link properties. :lol:

Populate your hashed file with the four key columns. Make sure that they are all marked as key columns.

In your Transformer stage you will be required to enter four reference key expressions - presumably one from each relevant stream input column.

On the output link of the Transformer stage add a constraint expression to test whether the lookup succeeded or not. Either use the NOTFOUND link variable (with a Not() function), or test any of the returned key columns with an IsNull() function (again within a Not() function).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Some other checks can be
1.) Trim all fields that populate the hash-file (from db) as well as those which lookup into it (from ff)
2.) Store ALL resulting values from the lookup from both source and lookup links into a seq file to analyse better.
andru
Participant
Posts: 21
Joined: Tue Mar 02, 2004 12:25 am
Location: Chennai

Post by andru »

Also make sure you do not have any numeric lookups on hash files. Convert all numeric fields to char fields before you do a lookup. For some reason, numeric lookups do not return proper value in hash file lookup.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? Never had that problem. Don't really want to derail this thread, but you shouldn't have to worry about 'numeric lookups'.
-craig

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