Output two records

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
rodre
Premium Member
Premium Member
Posts: 218
Joined: Wed Mar 01, 2006 1:28 pm
Location: Tennessee

Output two records

Post by rodre »

How can you do the following: :?
A file coming in through DataStage has one record coming in. The reference file has two records, which are stored in a hash file. We would like to have in the output two records. A left or right join in a query would work, but how can you do this in DataStage?
Example:
The file has:
zip_code, comp_cd, resp_cd, zipcount
00959, A, E, 1

The hash file has:
Zip_code, comp_cd, resp_cd, zipcount, RSID, ZIP_SPLIT_QTY, Perzipcount
00959, A, E, 1, 3G6D, 90, 0.9,
00959, A, E, 1, 3G6M, 10, 0.1,

Thanks!
Rodre :)
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Hi Rodre,

If you have the reference file in a sequential file rather than a hashed file. Then you can try using the 'Merge' Stage. You can perform the following joins using the 'Merge' Stage:

Code: Select all


Pure Inner Join

Complete Set

Right and Left Only

Right Outer Join

Left Outer Join

Right Only

Left Only

HTH,

Naveen.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

naveen is right. use the merge stage to achieve your goal. if you use a hash file, depending on your key, the duplicates will be removed. check and make sure you have those two records in the hash file which i highly doubt, as your key would be one of the first four columns, which are identical. hash file will skip the first record and store the second record only.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Hi Rodre

Another way to think is to swap your Sequential file to reference and hash file as your main file. Treat your hash file as source and convert your input Sequential file to hash file. This is just another way to do
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Post Reply