I have five different file, with Cust-Id & Date as Key for all.
When ever the Cust-ID & Date in all the five Files is same i have to join all the five records to one single record in the output file.
Eg: If the Cust -ID & date is available in all the files then i will have to merge all the records from these five files into a single record.
If the Cust-Id & Date are available in only file one & file 3 then merge only those two records as a single record, leaving the rest of the feilds as blanks.
Code: Select all
File 1
Cust-ID Date DOB Acct Type
111 20110303 19840319 Current
111 20110202 19840319 Saving
111 20110101 19840319 Current
222 20110303 19840319 Current
222 20110202 19840319 Saving
222 20110101 19840319 Current
File 2
Cust-ID Date Place
111 20110202 London
111 20110112 Manchestre
222 20110202 London
File 3
Cust-id Date Dept
111 20110303 Fraud
111 20110112 security
222 20110303 Fraud
File 4
Cust-ID Date Indicator
111 20110112 None
111 20110101 PEP
222 20110112 None
222 20110101 PEP
File 5
Cust-ID Date Email
111 20110112 Gmail
111 20110101 Yahoo
222 20110112 Gmail
222 20110101 Yahoo
Output
Cust-ID Date DOB Acct Type Place Dept Indicator Email
111 20110303 19840319 Current Fraud
111 20110202 19840319 Saving London
111 20110112 Manc secur None Gmail
111 20110101 19840319 Current PEP Yahoo
222 20110303 19840319 Current Fraud
222 20110202 19840319 Saving London
222 20110112 None Gmail
222 20110101 19840319 Current PEP Yahoo
Regards,
Raul