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

SEPARATE UNIQUE and NON-UNIQUE in SEPARATE FILES


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mohitsethi

New User


Joined: 19 Apr 2015
Posts: 4
Location: India

PostPosted: Thu Oct 01, 2020 9:47 pm
Reply with quote

Hi,

We all know SUM FIELDS=NONE and XSUM works fine and keeps the first record in SYSOUT and all duplicate records in XSUM.

My requirement is that I want all references of DUPLICATE record in another file and all unique records in one file. How can we do it.

Given that sort key is Composite Key of:
Name and Role - SAMANTHA and DEV (col: 3 - 10,20-23)

Example:
01SAMANTHA NNYY112 DEV1PROGRAMMER
01SAMANTHA NNYY112 DEV2MANAGER
01 MICHAEL NNYY121 DEV1PROGRAMMER
01 JAMES YNNY341 MGR4EXECUTIVE



File 1 - Unique records

01 MICHAEL NNYY121 DEV1PROGRAMMER
01 JAMES YNNY341 MGR4EXECUTIVE

File 2 - Non Unique records

01SAMANTHA NNYY112 DEV1PROGRAMMER
01SAMANTHA NNYY112 DEV2MANAGER
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Thu Oct 01, 2020 10:09 pm
Reply with quote

Do not double post your question when you know exactly what SORT product you are using. Also make use of Code tags when presenting data.

The best approach for your requirement might be JOINKEYS. You find plenty of samples here.

Code:
Name and Role - SAMANTHA and DEV (col: 3 - 10,20-23)

Your sample output is wrong as DEV1 and DEV2 (Key 20..23) are unique as well for Name SAMANTHA.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Fri Oct 02, 2020 12:52 am
Reply with quote

Simplified solution using SYNCTOOL:
Code:
//SEPARATE EXEC PGM=SYNCTOOL                                 
//IN       DD *                                               
01SAMANTHA NNYY112 DEV1PROGRAMMER                             
01SAMANTHA NNYY112 DEV2MANAGER                               
01 MICHAEL NNYY121 DEV1PROGRAMMER                             
01   JAMES YNNY341 MGR4EXECUTIVE                             
/*                                                           
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//UNIQ     DD SYSOUT=*                                       
//DUPS     DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  SELECT FROM(IN) TO(DUPS) ON(3,10,BI) ON(20,3,BI) ALLDUPS - 
    DISCARD(UNIQ)                                             
/*
Back to top
View user's profile Send private message
mohitsethi

New User


Joined: 19 Apr 2015
Posts: 4
Location: India

PostPosted: Mon Oct 05, 2020 4:54 pm
Reply with quote

Thanks for the code sample Joerg. I am not looking to discard UNIQ and persist that in file1 (UNIQ) and file2 (DUPS).

The key is 20-22 actually. Sorry for the typo.

Thanks,
Mohit

Joerg.Findeisen wrote:
Simplified solution using SYNCTOOL:
Code:
//SEPARATE EXEC PGM=SYNCTOOL                                 
//IN       DD *                                               
01SAMANTHA NNYY112 DEV1PROGRAMMER                             
01SAMANTHA NNYY112 DEV2MANAGER                               
01 MICHAEL NNYY121 DEV1PROGRAMMER                             
01   JAMES YNNY341 MGR4EXECUTIVE                             
/*                                                           
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//UNIQ     DD SYSOUT=*                                       
//DUPS     DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  SELECT FROM(IN) TO(DUPS) ON(3,10,BI) ON(20,3,BI) ALLDUPS - 
    DISCARD(UNIQ)                                             
/*
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


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

PostPosted: Mon Oct 05, 2020 6:26 pm
Reply with quote

If you RTFM, you will see that SELECT with ALLDUPS will copy all duplicate records to the DUPS ddname and DISCARD will copy all other records yo the UNIQ ddname. The records are not discarded.

Garry.
Back to top
View user's profile Send private message
mohitsethi

New User


Joined: 19 Apr 2015
Posts: 4
Location: India

PostPosted: Tue Oct 06, 2020 11:32 am
Reply with quote

Thanks Garry. I indeed RTFM :-)

Have a great tuesday!!

Garry Carroll wrote:
If you RTFM, you will see that SELECT with ALLDUPS will copy all duplicate records to the DUPS ddname and DISCARD will copy all other records yo the UNIQ ddname. The records are not discarded.

Garry.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Tue Oct 06, 2020 7:40 pm
Reply with quote

mohitsethi wrote:
Thanks Garry. I indeed RTFM :-)

Have a great tuesday!!

Garry Carroll wrote:
If you RTFM, you will see that SELECT with ALLDUPS will copy all duplicate records to the DUPS ddname and DISCARD will copy all other records yo the UNIQ ddname. The records are not discarded.

Garry.

At least not with the right keyword. Anyways, Here is the recent post discussing the same which you missed to get it in your search.
ibmmainframes.com/viewtopic.php?t=67928&highlight=
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 -> SYNCSORT

 


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 combine multiple unique records into ... DFSORT/ICETOOL 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