pass same value

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
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

pass same value

Post by adams06 »

I have a source data
col1 col2
12345-3 123
12345-1 456
12345-2 789

I have 3 lkp ( with id and seq number as key columns)

lkp1
col1 col2 col3
12345 1 abc
12345 2 cba
12345 3 bca

lkp2
col1 col2 col3
12345 1 abc
12345 2 cba
12345 3 bca

lkp3
col1 col2 col3
12345 1 abc
12345 2 cba
12345 3 bca

When there is a match on 1st lkp

col1 col2
abc 456

When there is a match on 2st lkp

col1 col2
cba 456

When there is a match on 3st lkp

col1 col2
bca 456

I need to pass the col2 value which is coming out from 12345*1 456 to all the seq file

Any help
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Somehow, no matter how many times I read your post I am having trouble understanding your requirement. Can you be more clear on how your final output should look? How many records do you expect to see based upon the example you have provided?
Kris

Where's the "Any" key?-Homer Simpson
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Post by adams06 »

kris007 wrote:Somehow, no matter how many times I read your post I am having trouble understanding your requirement. Can you be more clear on how your final output should look? How many records do you expect to see based upon the example you have provided?
If i am writing to the same file i would like to see 3 records

col1 col2
abc 456
cba 456
bca 456
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

For my eyes, all 3 of your lookups appear identical. So what is the purpose of having 3 when you can do with 1 ?

Also what is your condition / business logic of results. Better give different values to the lookups - if that is your case.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

I tried sleeping on this. To me it appears as if you need to swap your reference and source stages. And there should be some kind of a business requirement that allows you to pick up the required record.
Kris

Where's the "Any" key?-Homer Simpson
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Post by adams06 »

Sainath.Srinivasan wrote:For my eyes, all 3 of your lookups appear identical. So what is the purpose of having 3 when you can do with 1 ?

Also what is your condition / business logic of results. Better give different values to the lookups - if that is your case.
when i created the hashed file i assigned value 1 for seq number for lkp1,
i assigned value 2 for seq number for lkp2,i assigned value 3 for seq number for lkp3

now When i use them as lkp's, i assigned vales for the key expression as folows

lkp1:

field(col1,'-',1,1) for id
"-1" for seq numer

lkp2:

field(col1,'-',1,1) for id
"-2" for seq numer

lkp3:
field(col1,'-',1,1) for id
"-3" for seq numer


constraints:
If source.col1 = lkp1.col1 : "-1" Then @TRUE Else @FALSE
If source.col1 = lkp1.col1 : "-2" Then @TRUE Else @FALSE
If source.col1 = lkp1.col1 : "-3" Then @TRUE Else @FALSE

i need to pass through the value which is held by xxxxx-1

i need to pass through col2 value of The record with "xxxxx-1" to lkp2 col2 as well as lkp3 col2

o/p:

abc 456 /* from lkp1
cba 789 /* from lkp2
bca 123 /* from lkp3

i am expecting o/p to be

col1 col2
abc 456
cba 456
bca 456
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Maybe I am a bit think here. I read your post a few times. But my brain has declined entry for your pseudocode.

You mention lookup, sequence, constraint, passing to all lookups etc etc. Also you claim that the hashed file is source from your input stream.

It will be useful to have some different values than 'abc' and '456' to explain.

Also how do you expect to get '456' for all your output rows when you have 3 different col3 entries in the source ? Even your penutimate step contains different values for col3.

There are loads of possible ways I am imagine your requirement - but want to confirm from you before saying anything.
Post Reply