View previous topic :: View next topic
|
Author |
Message |
subramanianup Warnings : 1 New User
Joined: 18 May 2005 Posts: 46 Location: Bangalore, INDIA
|
|
|
|
Join 2 files with Key is in differnt Places if key matches write records from first file.
Input file 1(Record lenth 80)
1234XXXXXXX...
2345XXXXXXX...
INput File 2(record length 40)
XXXX5464....
XXXX1234....
XXXX2345....
XXXX4546....
The required output file
1234XXXXXXX...
2345XXXXXXX... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/80)
//IN2 DD DSN=... input file2 (FB/40)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1)
COPY FROM(IN2) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(1,4,CH) FIRSTDUP
/*
//CTL1CNTL DD *
INREC BUILD=(1:5,4,80:X)
/*
|
|
|
Back to top |
|
|
subramanianup Warnings : 1 New User
Joined: 18 May 2005 Posts: 46 Location: Bangalore, INDIA
|
|
|
|
Hi Frank,
One more questions if 1st File is like follows
Input file 1(Record lenth 80)
1234XXXXXXX...
1234XXXXXXX...
1234XXXXXXX...
2345XXXXXXX...
INput File 2(record length 40)
XXXX5464....
XXXX1234....
XXXX2345....
XXXX4546....
The required output file
1234XXXXXXX...
2345XXXXXXX...
Could you please help me how to achieve this? |
|
Back to top |
|
|
subramanianup Warnings : 1 New User
Joined: 18 May 2005 Posts: 46 Location: Bangalore, INDIA
|
|
|
|
Hi Frank The File 1 looks like as follows
Input file 1(Record lenth 80)
1234XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
Please omit my above update |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Please start over and show a complete example of the records in each input file and what you expect for output, covering all cases. Indicate if either or both input files has duplicates within it (it appears from your example that input file1 has dups, but input file2 doesn't - is that correct?). |
|
Back to top |
|
|
subramanianup Warnings : 1 New User
Joined: 18 May 2005 Posts: 46 Location: Bangalore, INDIA
|
|
|
|
Sorry Frank I haven't Covered all the Cases. both the Input file containing Duplicates....If matches found from file 1 with File 2 we need to write only one record from first file. My Input file format and expected file format as follows,
Input file 1(Record length 80)
1234XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
Input file 2(Record length 40)
XXXX5464....
XXXX1234....
XXXX2345....
XXXX2345....
XXXX2345....
XXXX2345....
XXXX4546....
XXXX4546....
XXXX5568....
Output File
1234XXXXXXX...
2345XXXXXXX... |
|
Back to top |
|
|
Sushil Kurian
New User
Joined: 09 Feb 2009 Posts: 1 Location: India
|
|
|
|
Hope this helps.
Code: |
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=input file1 (FB/80)
//IN2 DD DSN=input file2 (FB/40)
//TMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))
//OUT DD DSN=output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CTL1)
COPY FROM(IN2) TO(TMP1) USING(CTL2)
SPLICE FROM(TMP1) TO(OUT) ON(1,4,CH) WITH(81,1) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'11')
/*
//CTL2CNTL DD *
INREC BUILD=(1:5,4,81:C'22')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(81,2,CH,EQ,C'21'),BUILD=(1,80)
/*
|
/* |
|
Back to top |
|
|
|