Logic Question

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

g_rkrish
Participant
Posts: 264
Joined: Wed Feb 08, 2006 12:06 am

Logic Question

Post by g_rkrish »

Hi I have a Logic questions..It's basicall a table match up but

There are two options in the table 1 to look in to table 2...

Table has following examples of vaules

MatchString Type

10 1
104 1
14578 2

Where 1 represent starts with that string we should macth a string from another table.....

where 2 Represent Contains that string match with same string that we are matching for earlier one....

Table 2 has values like

1045578
104444
1034567
2414578

when ever i find the those matched values i should populate to another table with the table 2 value....

this is the logic that i need to code..so i tried to search with the substring and the mulitple row look up i used the uv stage..but am not getting the result i wanted..Pls help me out this....
Last edited by g_rkrish on Thu Nov 08, 2007 10:08 pm, edited 1 time in total.
RK
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Two Transformer stages, with the second lookup being conditional upon success of the first (a constraint in the first Transformer stage). Use other output links if needed to capture rows that fail either lookup.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
g_rkrish
Participant
Posts: 264
Joined: Wed Feb 08, 2006 12:06 am

Post by g_rkrish »

ray.wurlod wrote:Two Transformer stages, with the second lookup being conditional upon success of the first (a constraint in the first Transformer stage). Use other output links if needed to capture rows that fail ei ...

Ray,

can i know what constrint i should use here..also does codntion you are suggesting here is with transformer....Also the substring i am using is

substrings(table2string,1,len(table1string) = table1string

This is not seems to be working also..I solved the starts with option by left function..is this a right method to use or are you suggesting some thing else...

Thanks for your help....
RK
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I read the problem as the more general one where, if the second column is 1 you need a lookup WHERE KEYVALUE LIKE '?%' but, if the second column is 2 you need a lookup WHERE KEYVALUE LIKE '%?%' - you can not do the both in the same Transformer stage. You also can't solve it using Hashed File stages.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
g_rkrish
Participant
Posts: 264
Joined: Wed Feb 08, 2006 12:06 am

Post by g_rkrish »

ray.wurlod wrote:I read the problem as the more general one where, if the second column is 1 you need a lookup WHERE KEYVALUE LIKE '?%' but, if the second column is 2 you need a lookup WHERE KEYVALUE LIKE '% ...


sorry ray for the late replay..I tried your way but where do i give the like statement..But i can't able to under stand can you explain me in detail....

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

Post by ray.wurlod »

You give the SQL statement in the stage that is servicing your reference link.

As for "in detail", perhaps purchasing premium membership would permit you to read my reply in its entirety.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
g_rkrish
Participant
Posts: 264
Joined: Wed Feb 08, 2006 12:06 am

Post by g_rkrish »

ray.wurlod wrote:You give the SQL statement in the stage that is servicing your reference link.

As for "in detail", perhaps purchasing premium membership would permit you to read my reply in its entirety.
Ray,

I do have that with my friend..Thanks for your response.....
RK
g_rkrish
Participant
Posts: 264
Joined: Wed Feb 08, 2006 12:06 am

Post by g_rkrish »

ray.wurlod wrote:You give the SQL statement in the stage that is servicing your reference link.

As for "in detail", perhaps purchasing premium membership would permit you to read my reply in its entirety.
There no error but it retrives 0 records but we do have matching records though..what can we do about it Ray....

Thank you very much for your help.....
RK
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Stop. Step back. Ignore DataStage for the moment. Write out (in English) a complete specification of what is supposed to happen, including one or two examples. Then post that here.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
g_rkrish
Participant
Posts: 264
Joined: Wed Feb 08, 2006 12:06 am

Post by g_rkrish »

ray.wurlod wrote:Stop. Step back. Ignore DataStage for the moment. Write out (in English) a complete specification of what is supposed to happen, including one or two examples. Then post that here. ...
Ok here is what it is...

We have a tableA. where we have strings like 1000 10001 1004..

There is another tableb which has real data....

The question is is ..

We need to find ...
1.What are the string in Table B that starts with strings in table A
2.What are the strings in Table B that contains strings in table A
3.What are the strings in Table B that is equal strings to table A

Pls let me know if you need more explanation on the problem.....
RK
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Used-defined SQL (except, perhaps, for #3) on the reference input link's database stage.
SELECT columns FROM TableB WHERE keycolumn LIKE '?%';
SELECT columns FROM TableB WHERE keycolumn LIKE '%?%';
SELECT columns FROM TableB WHERE keycolumn = '?';

In all cases, provide the key value from TableA in the Reference Key expression.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
g_rkrish
Participant
Posts: 264
Joined: Wed Feb 08, 2006 12:06 am

Post by g_rkrish »

sorry Ray to bother you more..This problem is just annyoing me much....
SELECT columns FROM TableB WHERE keycolumn LIKE '?%'------Not works even though there is a matched column it just gives me 0 records but i did a work around with left function in the constraint part;
SELECT columns FROM TableB WHERE keycolumn LIKE '%?%' same result as before...but there is no work around...this is where am stuck;
SELECT columns FROM TableB WHERE keycolumn = '?' it works...;


thank you very very much..i don't know how to express my thanks ray for helping me patiently.....
RK
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I don't really have much else to offer. What stage type are you using on the reference link? If it's OCI you might try :1 instead of ? for the parameter marker.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
g_rkrish
Participant
Posts: 264
Joined: Wed Feb 08, 2006 12:06 am

Post by g_rkrish »

ray.wurlod wrote:I don't really have much else to offer. What stage type are you using on the reference link? If it's OCI you might try :1 instead of ? for the parameter marker. ...
I tried with db2API,ODBC,DRDBMS,UV......none of them works ray....

Thanks,
RK
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Time to involve your official Support provider, it seems.
-craig

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