Page 1 of 1

problem in lookup logic

Posted: Fri Dec 21, 2007 4:36 am
by ravij
Hi all,

I have a problem with my lookup logic. I am not able to implement the lookup logic in the job. The lookup code is given below.
Lookup OU to get OU_ID by condition

If Mid(FI_HOST_YYYYMMDD.TO,6,3) = 'นท.' Then

Concatenate('บน.', Concatenate(Mid(FI_HOST_YYYYMMDD.MORP,2,1), '.', Right((FI_HOST_YYYYMMDD.MORP),1)) ) = OU.ALS_NM1
and Right((OU.ALS_NM1),1) <> '.'

Else

Concatenate( '(', Mid(FI_HOST_YYYYMMDD.TO,6,3), ')' ) = Right((OU.ALS_NM1),5)

End IF
In that code i have two sources
1) FI_HOST its a file
2) OU its a table.
The output of this logic(OU_ID) goes thru Hashed file into Trnsf stage. Please help me how to develop this logic in DataStage Server job.

Thanks in advance.

Posted: Fri Dec 21, 2007 6:45 am
by WoMaWil
This is no universe code.

What do you realy want to do?

Вы хотите сделать? Опишите с словами.

Posted: Fri Dec 21, 2007 1:10 pm
by ray.wurlod
The lookup is performed, unconditionally (you get no choice on this) in a Transformer stage with a reference input.

The same Transformer stage can be used to perform the derivation of your output column. However, your logic is not clear. Use the Expression Editor to build your expression, noting that there is no Mid() function (you need to use Substring) and there is no assignment - it is a single line expression that you construct. Concatenate is an operator. Construct something like the following:

Code: Select all

If FI_HOST_YYYYMMDD.TO[6,3] = 'นท.' Then 'นท.' : FI_HOST_YYYYMMDD.MORP[2,1] : '.' : Right(FI_HOST_YYYYMMDD.MORP,1) Else '(' : FI_HOST_YYYYMMDD.TO[6,3] : Right(OU.ALS_NM1,5)

Posted: Fri Dec 21, 2007 9:54 pm
by ravij
I have one doubt. When I run my job with prev logic which mentioned in above post, I am getting records into Hash file(With Only 1col(OU_ID) but not passing those records to transformer stage.
Do we must have Key col in output link in hash file to get the data into next stage(Transf stage)?

Thanks in advane.

Posted: Sat Dec 22, 2007 1:23 am
by ray.wurlod
It's clear that I don't understand your logic - my guess was off the mark. Please write out a specification in English of what is supposed to happen - don't mention DataStage, hashed files or anything else in the specification.

For now I will ignore the question about the hashed file.

Have you ever undertaken a DataStage training class? Was it one of the vendors' (IBM's) classes, or some other?