Join logic

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
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Join logic

Post by rafidwh »

Hi All,
Need help in implementing the following logic

I have three files as shown in the below given format

File1

ID IND
1 Y

File2

ID IND
1 Y
1 X
1 A
1 X

File3
ID IND
1 Y
1 Z

All the above 3 files are the reference files and the input file or the main file will look like

Main File
ID IND1 IND2 IND3
1 - - -

The output should be like

ID IND1 IND2 IND3
1 Y X A

IND1 = Y since it found match in first file
IND2 = X (Since it has more occurances than A)
IND3 = A (Since it is the next most dominant in the second file)

We will pull the indicator value from third file only when we dont find any match from 1st and 2nd file.

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

Post by ray.wurlod »

Server or parallel job? You have posted in the server forum but marked the job as parallel. The answer will be different depending upon job type.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

Ray,

Sorry for posting on server forum. Its a parallel job.

Thanks!
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

Hi,

Any idea team.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

That must be straight-forward. What have you tried so far ?

Please post your attempts so others can guide you rather than asking others to 'do it for you'.

Anyhow, one method will be
1.) Get ind1 from your reference 1
2.) Aggregate the values in your files and sort by desc id and count.
3.) Take first two rows for ind 2 and ind 3.

I will leave this logic to your imagination.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Waiting for question to be posted in Parallel forum.

If I were to answer the question here, my answer would pertain to server jobs and waste both your time and mine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply