Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Compare two unsorted files in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
tamminenisidhartha
Currently Banned

New User


Joined: 31 Oct 2012
Posts: 43
Location: INDIA

PostPosted: Tue Feb 12, 2013 3:35 pm    Post subject: Compare two unsorted files in JCL
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Feb 12, 2013 3:53 pm    Post subject:
Reply with quote

Which version of SORT are you using and what release level is it ?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Tue Feb 12, 2013 4:04 pm    Post subject: Reply to: Compare two unsorted files in JCL
Reply with quote

Quote:
The records in it are not sorted.


to compare on some key You will have to sort the files!
Back to top
View user's profile Send private message
tamminenisidhartha
Currently Banned

New User


Joined: 31 Oct 2012
Posts: 43
Location: INDIA

PostPosted: Tue Feb 12, 2013 4:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1542
Location: Andromeda Galaxy

PostPosted: Tue Feb 12, 2013 4:26 pm    Post subject:
Reply with quote

Dear tamminenisidhartha,

Do you want to find the duplicates or compare the files?
Back to top
View user's profile Send private message
tamminenisidhartha
Currently Banned

New User


Joined: 31 Oct 2012
Posts: 43
Location: INDIA

PostPosted: Tue Feb 12, 2013 4:28 pm    Post subject:
Reply with quote

I want to write the only first duplicate record into a file and non duplicate records into other file.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1542
Location: Andromeda Galaxy

PostPosted: Tue Feb 12, 2013 4:35 pm    Post subject:
Reply with quote

Suppose your input contains multiple duplicates still you wanted to write the first duplicate record alone to output?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Tue Feb 12, 2013 4:40 pm    Post subject: Reply to: Compare two unsorted files in JCL
Reply with quote

check the manuals for the FIRST keyword
Back to top
View user's profile Send private message
tamminenisidhartha
Currently Banned

New User


Joined: 31 Oct 2012
Posts: 43
Location: INDIA

PostPosted: Tue Feb 12, 2013 4:47 pm    Post subject:
Reply with quote

@Pandora Box
Yes Pandora Box.
I want to write only the first duplicate record.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Tue Feb 12, 2013 4:57 pm    Post subject: Reply to: Compare two unsorted files in JCL
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods DFSORT/ICETOOL 6 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us