View previous topic :: View next topic
|
Author |
Message |
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
Hi all,
I am trying to implement a JCL which compares two files and writes the matching records into the output file1 and non-matching records into output file2.
The records in it are not sorted.
Two input files have the data from column 1 to 10 of char type.
I have seen other's jobs(JCL) in the internet as well but their logic's are not as exactly I wanted.
Could anyone help me on how to implement this logic ? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Which version of SORT are you using and what release level is it ? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
The records in it are not sorted. |
to compare on some key You will have to sort the files! |
|
Back to top |
|
|
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
Hi Enrico and Expat.
I am posting the code here.
//FSS320V JOB (VV,BOBBY),'SIDDU',NOTIFY=&SYSUID
//STEP010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FSS320.INFILE1.PS,DISP=SHR
// DD DSN=R04290.INFILE2.PS,DISP=SHR
//NODUPES DD DSN=FSS320.NODUPES.PS,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(20,10),RLSE),
// DCB=(RECFM=FBA,LRECL=80,BLKSIZE=800,DSORG=PS)
//DUPES DD DSN=FSS320.DUPES.PS,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(20,10),RLSE),
// DCB=(RECFM=FBA,LRECL=80,BLKSIZE=800,DSORG=PS)
//TOOLIN DD *
SELECT FROM (SORTIN) TO (NODUPES) -
ON (11,6,CH) NODUPS
SELECT FROM (SORTIN) TO (DUPES) -
ON (11,6,CH) ALLDUPS
/*
The problem with this code is the duplicate records are being written two times in the output file which contains the duplicate records.
The non duplicate records are being written correct. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Dear tamminenisidhartha,
Do you want to find the duplicates or compare the files? |
|
Back to top |
|
|
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
I want to write the only first duplicate record into a file and non duplicate records into other file. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Suppose your input contains multiple duplicates still you wanted to write the first duplicate record alone to output? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
check the manuals for the FIRST keyword |
|
Back to top |
|
|
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
@Pandora Box
Yes Pandora Box.
I want to write only the first duplicate record. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
in IT using the proper terminology is essential for good communications
what You are doing ( more or less successfully ) is isolate duplicates / non duplicates regardless of the file they come from
to compare TWO files You need to use the JOINKEYs approach
search the forum and You will find quite a few examples of it |
|
Back to top |
|
|
|