op
New User
Joined: 31 Oct 2006 Posts: 48 Location: Chennai
|
|
|
|
I have 2 files to be combined.
File 1 has the following information:
Cust-no loaninfo
There could be more than 1 record for each customer
File 2 has the following information:
Cust-no street-no city
In this file a customer has only 1 record.
*** Note: Few customers in File 1 may not have records in File 2.
After merging, every record in file 1 should have information from file 2, if available.
e.g.
File 1:
Cust-no1 loaninfo1
Cust-no1 loaninfo2
Cust-no2 loaninfo1
Cust-no3 loaninfo1
Cust-no3 loaninfo2
Cust-no3 loaninfo3
Cust-no3 loaninfo4
File 2:
Cust-no1 street-no1 city1
Cust-no3 street-no3 city3
After merging:
Cust-no1 loaninfo1 street-no1 city1
Cust-no1 loaninfo2 street-no1 city1
Cust-no2 loaninfo1
Cust-no3 loaninfo1 street-no3 city3
Cust-no3 loaninfo2 street-no3 city3
Cust-no3 loaninfo3 street-no3 city3
Cust-no3 loaninfo4 street-no3 city3
Thanks & Regards,
OP |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT/ICETOOL job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
Cust-no1 loaninfo1
Cust-no1 loaninfo2
Cust-no2 loaninfo1
Cust-no3 loaninfo1
Cust-no3 loaninfo2
Cust-no3 loaninfo3
Cust-no3 loaninfo4
/*
//IN2 DD *
Cust-no1 street-no1 city1
Cust-no3 street-no3 city3
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,8,CH) KEEPNODUPS -
WITHALL WITH(1,19)
/*
//CTL1CNTL DD *
INREC BUILD=(1,8,22:11,17)
/*
//CTL2CNTL DD *
INREC OVERLAY=(38:X)
/*
|
|
|