View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi,
I have two files. I have to compare these two files and I have to seperate the duplicates and NON-dupes using JCL.
My shop uses DFSORT. Could anybody give me a jcl on how i can perform it. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I have to compare these two files and I have to seperate the duplicates and NON-dupes using JCL. |
This is a rather ambiguous statement. It's not clear exactly what you want to do.
Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example. |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Input1:
Abdul
Prashant
Ram
Sam
Arun
Input2:
Abdul
Prashant
Ram
After comparison the output should like the one given below:
Output1:
Abdul
Prashant
Ram
Output2:
Sam
Arun |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
abdulrafi,
The following DFSORT/ICETOOL JCL will give you the desired results
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ABDUL
PRASHANT
RAM
SAM
ARUN
// DD *
ABDUL
PRASHANT
RAM
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT1) ON(1,10,CH) ALLDUPS DISCARD(OUT2) USING(CTL1)
//CTL1CNTL DD *
OUTFIL FNAMES=OUT1,REMOVECC,NODETAIL,
SECTIONS=(1,10,HEADER3=(1,80))
OUTFIL FNAMES=OUT2
//* |
|
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Thanks a lot for your help. The code is working.
But I have a doubt. Could you tell me what for,
SECTIONS=(1,10,HEADER3=(1,80)) this statement has been given for the file OUT1 and not for OUT2 |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
abdulrafi,
All the matching rows will be duplicates. Since you only wanted 1 record per duplicate , we use sections to eliminate the duplicates and only write the first dup.
Non matching keys are unique and you don't need to eliminate any records and hence we don't use sections
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
arindambanerjee
New User
Joined: 30 Jun 2007 Posts: 39 Location: India
|
|
|
|
Hi Kolusu,
Thanks a lot for bringing such an wonderful utility into light.I was not aware of this. Earlier I used to code Cobol pgm to find duplicate and non duplicate records.
But I have some doubts with the CTL card. can you please help me in explaining that. Iwent through the link as mentioned by you but still have some doubts. My understanding is given below:
OUTFIL FNAMES=OUT1,REMOVECC,NODETAIL,
SECTIONS=(1,10,HEADER3=(1,80))
OUTFIL FNAMES=OUT2
1. I think REMOVECC removes duplicate.
2. NODETAIL is just to extract records in position 1-10 as given in the SECTIONS.
3.Sections is used to declare the layout of the output or sysout, of 80 bytes and 1-10 position will have the key on which it is compared.
Please correct me if my understandings are wrong. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
Back to top |
|
|
|