Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 10202
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: 1529
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: 1529
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: 10202
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: 10202
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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts COMPARE command sivatechdrive TSO/ISPF 7 Fri Sep 16, 2016 4:31 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us