Arun Kumar Tupili
New User
Joined: 30 Nov 2006 Posts: 14 Location: Banglore
|
|
|
|
Hi,
I have a requirement. I have two input files. Both have keys in positions 1-2.
I need data if the keys for both files matches, the output file should have the matching key,remaining data in file1 and remaining data in file2.
File1
-----
A1 X1
B1 Y1
C1 Z1
C2 Z2
File2
-----
A1 X2
A2 X2
B1 Y2
A2 X2
C2 Z3
I want the output file as
Output
-------
A1 X1 X2
B1 Y1 Y2
C2 Z2 Z3
How to use DFSORT/ICETOOL to get the requirement done. I don't want to write a program.
I tried to merge the files into a single file and sort it.
I will get the corresponding duplicate records. but how to sort it to output file. |
|
subhasis_50
Moderator
Joined: 09 Mar 2005 Posts: 363 Location: Earth
|
|
|
|
Hi,
Here is the solution you asked for
Code: |
//STEP0100 EXEC PGM=ICETOOL
//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
A1 X1
B1 Y1
C1 Z1
C2 Z2
/*
//IN2 DD *
A1 X2
A2 X2
B1 Y2
A2 X2
C2 Z3
/*
//T1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
SORT FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,2,CH) WITH(7,2)
//CTL1CNTL DD *
OUTREC FIELDS=(1:1,2,4:4,2,6:5X)
//CTL2CNTL DD *
SORT FIELDS=(1,2,CH,A)
SUM FIELDS=NONE
OUTREC FIELDS=(1:1,2,7:4,2)
/*
|
|
|