IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare two files and remove duplicates


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shivendu

New User


Joined: 20 Feb 2009
Posts: 14
Location: Workstation

PostPosted: Mon Apr 06, 2009 12:31 pm
Reply with quote

Need to compare data in two files FILE1 and FILE2. Data which is present ONLY in FILE2 should be written to a new file FILE3 (i.e removing
duplicates)

Both files have same format and rec length.
Need to do thru SORT only (or NATURAL) and not ICETOOL as its not available here.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 1:13 pm
Reply with quote

Shivendu wrote:
and not ICETOOL as its not available here.
How did you conclude this? Which SORT product is installed at your shop? If Sync Sort what version of that?
Back to top
View user's profile Send private message
Shivendu

New User


Joined: 20 Feb 2009
Posts: 14
Location: Workstation

PostPosted: Mon Apr 06, 2009 1:32 pm
Reply with quote

Coz I tried with ICETOOL and its not working.
It's a bit urgent.
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 1:34 pm
Reply with quote

Quote:
Coz I tried with ICETOOL and its not working


As anuj said could you let us know which sort product is installed in your shop with the version?
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 1:37 pm
Reply with quote

Quote:
and not ICETOOL as its not available here.



What is the pgm name you used for sort?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Mon Apr 06, 2009 1:38 pm
Reply with quote

just take a decision,
ICETOOL not available, or You made mistakes in using it

not working is just blaming somebody else for one' s errors

did You search the forums with , for exampe "sort duplicates"
I am sure that You will find many hints on how to proceed
and what info to post in order to get better help
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 1:52 pm
Reply with quote

This
Quote:
and not ICETOOL as its not available here.
and this
Quote:
Coz I tried with ICETOOL and its not working
are totally different wordings...in a crude sense...if something is not working is from "application programmer's" point of view and something is not available is to do with "system programmers"...
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 1:57 pm
Reply with quote

Hi,

To start with, you can try this JCL:
Code:
//************************************************************** 
//*THIS JCL WILL GIVE THREE OUTPUTS: OUT12,OUT1 & OUT2           
//*OUT12: OUTPUT-FILE WITH COMMON RECORDS IN TWO INPUT-FILES.     
//*OUT1 : OUTPUT-FILE WITH RECORDS ONLY IN INPUT IN1 NOT IN IN2. 
//*OUT2 : OUTPUT-FILE WITH RECORDS ONLY IN INPUT IN2 NOT IN IN1. 
//* ONE NEED TO CHANGE THE KEY-LENGTH WHILE USING JCL.           
//*CHANGE KEY LENGTH IN 'ON(1,3,CH)'                             
//************************************************************** 
//*                                                               
//STEP001 EXEC PGM=ICETOOL/SYNCTOOL                                     
//TOOLMSG DD SYSOUT=*                                           
//DFSMSG  DD SYSOUT=*                                           
//IN1     DD *
111 $$$$$
111 $$$$$
222 AAAAA
333 FFFFF
444 GGGGG
555 CCCCC
666 $$$$$
777 AAAAA
888 FFFFF
999 GGGGG
999 GGGGG
999 GGGGG
999 GGGGG
/*
//IN2     DD *
111 BBBBB
333 DDDDD
444 FFFFF
555 HHHHH
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),             
//           DISP=(MOD,PASS)                                   
//OUT12   DD DSN=XXXXXX.MATCHED.OUTPUT,DISP=(NEW,CATLG,DELETE)
//OUT1    DD DSN=XXXXXX.ONLY.IN.IN1.OUT,DISP=(NEW,CATLG,DELETE)
//OUT2    DD DSN=XXXXXX.ONLY.IN.IN2.OUT,DISP=(NEW,CATLG,DELETE)
//TOOLIN  DD *                                                 
  COPY FROM(IN1) TO(T1) USING(CTL1)                             
  COPY FROM(IN2) TO(T1) USING(CTL2)                             
  SPLICE FROM(T1) TO(OUT12) ON(1,3,CH) WITH(81,1) -             
  USING(CTL3) KEEPNODUPS                                       
/*                                                             
//CTL1CNTL DD *                                                 
  INREC OVERLAY=(80:C'11')                                     
/*                                                             
//CTL2CNTL DD *                                                 
  INREC OVERLAY=(80:C'22')                                     
/*                                                             
//CTL3CNTL DD *                                               
  OUTFIL FNAMES=OUT12,INCLUDE=(80,2,CH,EQ,C'12'),BUILD=(1,80) 
  OUTFIL FNAMES=OUT1,INCLUDE=(80,2,CH,EQ,C'11'),BUILD=(1,80)   
  OUTFIL FNAMES=OUT2,INCLUDE=(80,2,CH,EQ,C'22'),BUILD=(1,80)   
/*                                                             


"eidted"
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 2:02 pm
Reply with quote

Hi Anuj,
Code:
STEP001 EXEC PGM=ICECTOOL/


Will this work?
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 2:05 pm
Reply with quote

Hi Shivendu,

If
Code:
PGM=ICETOOL
is not working you can trying using
Code:
 PGM=ICEMAN
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 2:28 pm
Reply with quote

Hi,

By this:
Code:
PGM=ICECTOOL/SYNCTOOL
I meant code either one of these based on the product he has on his shop . . . though on Synsort shops ICETOOL will invoke SYNTOOL.

If you dont keep that "/" in below code, this
himanshu7 wrote:
Code:
STEP001 EXEC PGM=ICECTOOL/
should work.
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 2:31 pm
Reply with quote

Quote:
I meant code either one of these based on the product he has on his shop .


But Syncsort has any PGM=ICECTOOL?

Or it should be PGM=ICETOOL?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 2:32 pm
Reply with quote

himanshu7 wrote:
If
Code:
PGM=ICETOOL
is not working you can trying using
Code:
 PGM=ICEMAN
I wish Frank is not looking in this thread . . . icon_neutral.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 2:39 pm
Reply with quote

himanshu7 wrote:
But Syncsort has any PGM=ICECTOOL?
Yeah spell check time for me, it should be ICETOOL - I wrote this code on the fly..so . . . icon_redface.gif
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 2:50 pm
Reply with quote

Quote:
I wish Frank is not looking in this thread . . .


Please clarify, is there anything wrong?

As in our shop we are using Syncsort whcih is giving RC 20 for ICETOOL but RC 0 for the same ICEMAN sorting.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 3:19 pm
Reply with quote

himanshu7 wrote:
As in our shop we are using Syncsort whcih is giving RC 20 for ICETOOL but RC 0 for the same ICEMAN sorting.
Did you really execute the job as posted? When you run it using ICEMAN it would expect DD names like SORTIN, SORTOUT and SYSIN and they are not there in the job in question. . . icon_confused.gif

Which version of Sync Sort you are using at your shop?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 3:22 pm
Reply with quote

Hi,

Check these DFSORT links for the explanation of DD statements..

publib.boulder.ibm.com/infocenter/zos/v1r9/index.jsp?topic=/com.ibm.zos.r9.iceg200/icecom.htm

publib.boulder.ibm.com/infocenter/zos/v1r9/index.jsp?topic=/com.ibm.zos.r9.icea100/ice1ca20295.htm

PGM=ICEMAN and PGM=SORT invoke the sort product at your site.

DFSORT's ICETOOL (aliased to SYNCTOOL - is Syncsort, Inc.'s version of the ICETOOL package) provides additional functions beyond those found in DFSORT. ICETOOL is shipped free with DFSORT (has been since 1991) -if you have DFSORT, you have ICETOOL.

You have Syncsort, not DFSORT, so you should be using Syncsort's books, not DFSORT's books, however, they can help you in this context at least (and more actually)...so I'e given the links . . .
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 3:27 pm
Reply with quote

Hi Anuj,

We are using Syncsort..
Code:
SYNCSORT FOR Z/OS  1.3.1.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Apr 06, 2009 3:32 pm
Reply with quote

Then the job should work with ICETOOL or SYNCTOOL as posted . . .
Back to top
View user's profile Send private message
Shivendu

New User


Joined: 20 Feb 2009
Posts: 14
Location: Workstation

PostPosted: Mon Apr 06, 2009 4:38 pm
Reply with quote

Quick help needed...
Code:
//TOOLIN DD *                                           
COPY FROM(IN1) TO(T1) USING(CTL1)                       
COPY FROM(IN2) TO(T1) USING(CTL2)                       
SELECT FROM(T1) TO(OUT) ON(1,13,CH) NODUPS USING(CTL3)
/*                                                     
//CTL1CNTL DD *                                         
  INREC OVERLAY=(3519:C'1')                             
/*                                                     
//CTL2CNTL DD *                                         
  INREC OVERLAY=(3519:C'2')                             
/*                                                     
//CTL3CNTL DD *                                         
  OUTFIL FNAMES=OUT,INCLUDE=(3519,1,CH,EQ,C'2'),       
    BUILD=(1,3518)                                     
/*                                                     


IN1

Code:
1001789877AQ1   1
1001910140AQ1   1
1001910140AQ1   2


IN2
Code:
1001789794AQ1   1
1001789877AQ1   1
1001910140AQ1   1
1001910140AQ1   2


OUTPUT i m gettng is
Code:
1001789794AQ1   1


But I want
Code:
1001789794AQ1   1
1001910140AQ1   1
1001910140AQ1   2



[/code]
Back to top
View user's profile Send private message
Shivendu

New User


Joined: 20 Feb 2009
Posts: 14
Location: Workstation

PostPosted: Mon Apr 06, 2009 4:54 pm
Reply with quote

Quick help needed...
Code:
//TOOLIN DD *                                           
COPY FROM(IN1) TO(T1) USING(CTL1)                       
COPY FROM(IN2) TO(T1) USING(CTL2)                       
SELECT FROM(T1) TO(OUT) ON(1,13,CH) NODUPS USING(CTL3)
/*                                                     
//CTL1CNTL DD *                                         
  INREC OVERLAY=(3519:C'1')                             
/*                                                     
//CTL2CNTL DD *                                         
  INREC OVERLAY=(3519:C'2')                             
/*                                                     
//CTL3CNTL DD *                                         
  OUTFIL FNAMES=OUT,INCLUDE=(3519,1,CH,EQ,C'2'),       
    BUILD=(1,3518)                                     
/*                                                     


IN1

Code:
1001789877AQ1   1



IN2
Code:
1001789794AQ1   1
1001789877AQ1   1
1001910140AQ1   1
1001910140AQ1   2


OUTPUT i m gettng is
Code:
1001789794AQ1   1


But I want (whatever is in IN2 but not in IN1)
Code:
1001789794AQ1   1
1001910140AQ1   1
1001910140AQ1   2



[/code][/quote]
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 5:13 pm
Reply with quote

Plz customize and use the below code...


Code:
//STEP001  EXEC  PGM=ICETOOL                               
//TOOLMSG  DD    SYSOUT=*                                   
//SSMSG    DD    SYSOUT=*                                   
//FILEA    DD    DSN=DGCVPG2.V831.LISTDSN.FILTER2,DISP=SHR 
//FILEB    DD    DSN=DGCVPG2.V831.LISTDSN.FILTER4,DISP=SHR 
//FILEC    DD    DSN=DGCVPG2.REGION.DELTA,DISP=SHR         
//T1       DD    DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(15,15)),   
//     DISP=(MOD,PASS)                                     
//TOOLIN DD *                                               
COPY FROM(FILEB) TO(T1) USING(CTL1)                         
COPY FROM(FILEA) TO(T1) USING(CTL2)                         
SELECT FROM(T1) TO(FILEC) ON(1,40,CH) NODUPS USING(CTL3)   
/*                                                         
//CTL1CNTL DD *                                             
  INREC OVERLAY=(65:C'B')                                   
/*                                                         
//CTL2CNTL DD *                                             
  INREC OVERLAY=(65:C'A')                                   
/*                                                         
//CTL3CNTL DD *                                   
  OUTFIL FNAMES=FILEC,INCLUDE=(65,1,CH,EQ,C'B'),   
    BUILD=(1,64)                                   
/*     
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 5:14 pm
Reply with quote

IN1 is fileA
IN2 is FileB
FileC is Delta file....
Back to top
View user's profile Send private message
Shivendu

New User


Joined: 20 Feb 2009
Posts: 14
Location: Workstation

PostPosted: Mon Apr 06, 2009 5:26 pm
Reply with quote

Did the same ....problem is whatever is duplicate (1-13 bytes) in IN2 (though not present in IN1) is not getting writen in output.
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 6:15 pm
Reply with quote

Hi Shivendu
Quote:

Did the same ....problem is whatever is duplicate (1-13 bytes) in IN2 (though not present in IN1) is not getting writen in output.



The above code is tested in my system and working fine.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts 3 files concatenated to 1 DFSORT/ICETOOL 2
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Compare 2 alphabets in a REXX and fin... CLIST & REXX 2
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files and write Matched/Unm... JCL & VSAM 8
Search our Forums:

Back to Top