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

write matched and unmatched records


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

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Sun Mar 27, 2011 10:49 pm
Reply with quote

Hi,

I am trying the below:

File1 , RecLen:80 and RecFmt:FB.
AA11198
BB78990
CC87690

File2, RecLen:80 and RecFmt:FB.
AA11198
GGG8970
CC87690

I want to compare these two files and write the matching records to one file and unmatched records to other file(Sync Sort).

I tried with the options available in the Forum but could be successful. Any pointers will be greatly helpful.

Thanks...
Back to top
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Sun Mar 27, 2011 10:52 pm
Reply with quote

Hi,

(Corrected the Typo)

I am trying the below:

File1 , RecLen:80 and RecFmt:FB.
AA11198
BB78990
CC87690

File2, RecLen:80 and RecFmt:FB.
AA11198
GGG8970
CC87690

I want to compare these two files and write the matching records to one file and unmatched records to other file(Sync Sort).

I tried with the options available in the Forum but could not be successful. Any pointers will be greatly helpful.

Thanks...
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Mar 28, 2011 12:46 am
Reply with quote

Quote:
options available in the Forum but could not be successful


Which 'options'. How were you unsuccessful i.e. what errors did you get with what control info?

Mind-reading day was yesterday.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Mar 28, 2011 2:59 am
Reply with quote

Hi,

are there duplicates in either file ? or maybe I should say can there be duplicates in either file ?


Gerry
Back to top
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Mon Mar 28, 2011 11:37 am
Reply with quote

Hi Gcicchet,

No , there are no duplicates in either file.

Thanks...
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Mar 28, 2011 2:38 pm
Reply with quote

Hi,

as you have answered my questions although I don't know why you could not have provided the information requested by Nic, here is a solution

Code:
//S1       EXEC PGM=SYNCTOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN1      DD *                                                     
AA11198                                                             
BB78990                                                             
CC87690                                                             
//         DD *                                                     
AA11198                                                             
GGG8970                                                             
CC87690                                                             
/*                                                                 
//ALLDUPS  DD SYSOUT=*                                             
//NONDUPS  DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
SELECT FROM(IN1) TO(ALLDUPS) ON(1,80,CH) ALLDUPS DISCARD(NONDUPS)   
/*                                                                 


Gerry
Back to top
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Wed Mar 30, 2011 3:46 pm
Reply with quote

Hi Gerry,

Thanks for the above. I tried above and working fine.

I couldn't answer Nic as I was not havin access to check and provide the code at that time.

Nic, I am trying below:

Code:

//S1 EXEC PGM=SORT               
//SRTMSG DD SYSOUT=*                 
//SORTJNF1 DD *                       
A123B                         
A222B                         
A333C                         
//SORTJNF2 DD *                       
A111B                         
A222B                         
A333C                 
//SORTOUT DD SYSOUT=*                 
//SORTXSUM DD SYSOUT=*               
//SYSUDUMP DD SYSOUT=*               
//SYSOUT DD SYSOUT=*                 
//SYSIN DD *                         
  JOINKEYS FILES=F1,FIELDS=(1,5,A)   
  JOINKEYS FILES=F2,FIELDS=(1,5,A)   
  REFORMAT FIELDS=(F1:1,5,F2:1,5)     
  SUM FIELDS=NONE,XSUM               
  SORT FIELDS=(1,5,CH,A)             
/*                         



From above , I am getting the matched records, however not getting the unmatched ones (ie, the values to XSUM).

Ideally, I expect the SORTXSUM DD SYSOUT=* to contain unmatched records. Please point me if I am missing anything here...
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Mar 30, 2011 8:39 pm
Reply with quote

Actually I have never used SYNCSORT and do not have access to the manual but there will be an option that you have to specify to enable discards to be kept. Check the index for things like DUPS DISCARDS UNMATCHED.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Mar 31, 2011 11:59 am
Reply with quote

IIRC, the keyword you want to search for is UNPAIRED

Garry.
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

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top