Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SEPARATE UNIQUE and NON-UNIQUE in SEPARATE FILES

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: SEPARATE UNIQUE and NON-UNIQUE in SEPARATE FILES
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

Active User


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

PostPosted: Thu Oct 01, 2020 10:09 pm    Post subject:
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

Active User


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

PostPosted: Fri Oct 02, 2020 12:52 am    Post subject:
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    Post subject:
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: 1092
Location: Dublin, Ireland

PostPosted: Mon Oct 05, 2020 6:26 pm    Post subject:
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    Post subject: Thanks
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: 2492
Location: NY,USA

PostPosted: Tue Oct 06, 2020 7:40 pm    Post subject: Re: Thanks
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.
http://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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Group comparison/update between two f... premnath DFSORT/ICETOOL 8 Thu Oct 22, 2020 4:27 am
No new posts Need assistance formatting when joini... chillmo SYNCSORT 8 Wed Oct 21, 2020 10:56 am
No new posts Combining more 4 files with sorted or... bshkris DFSORT/ICETOOL 3 Thu Oct 08, 2020 10:57 am
No new posts Undesired result while joining files. Khupe SYNCSORT 3 Tue Sep 22, 2020 8:05 pm
No new posts Dynamically read input files using BP... Srinivas B COBOL Programming 20 Sat Sep 05, 2020 1:48 pm

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