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

Syncsort Matched / Unmatched records


IBM Mainframe Forums -> SYNCSORT
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
gkanswa

New User


Joined: 09 Feb 2009
Posts: 5
Location: Pune

PostPosted: Tue Mar 02, 2010 6:28 pm
Reply with quote

I need both matched and unmatched records.

I'm able to get the matched and unmatched records:

Code:

  JOINKEYS FILE=F1,FIELDS=(9,6,A,1,7,A)
  JOINKEYS FILE=F2,FIELDS=(1,6,A,7,7,A)
  JOIN UNPAIRED,F2                     
  REFORMAT FIELDS=(F2:1,80)             
  SORT FIELDS=COPY


Input1 (F1)
Code:

1234567 ABCDEF 1111111111
2222222 BBBBBB 4444444444
5555222 CCCCCC 3333333333
2266622 DDDDDD 4466444444


Input2 (F2)
Code:

ABCDEF1234567 WWWWWWWWW
BBBBBB2222222 YYYYYYYYY
BCCCBB2222242 YYYRYYYYY

output
Code:

ABCDEF1234567 WWWWWWWWW
BBBBBB2222222 YYYYYYYYY
BCCCBB2222242 YYYRYYYYY


I need matched and unmatched records in different files.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Mar 02, 2010 7:02 pm
Reply with quote

DO NOT start a new requirement on the end of an existing one, no matter if you do consider them similar. Start a new topic.

This has been asked so many times, you may also consider performing a search of the forum before posting.

Also, because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT and the topic will be moved to the correct forum. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in your site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Mar 02, 2010 9:22 pm
Reply with quote

gkanswa wrote:
Code:

  JOINKEYS FILE=F1,FIELDS=(9,6,A,1,7,A)
  JOINKEYS FILE=F2,FIELDS=(1,6,A,7,7,A)
  JOIN UNPAIRED,F2                     
  REFORMAT FIELDS=(F2:1,80)             
  SORT FIELDS=COPY

.
.
.
I need matched and unmatched records in different files.

If you need two files, why didn't you use two outputs?

You should add the F1 keys in the REFORMAT and use two OUTFILs including/omiting based upon the presence/absence of those keys.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Mar 03, 2010 2:24 am
Reply with quote

gkanswa wrote:
Code:
  JOIN UNPAIRED,F2                     
  REFORMAT FIELDS=(F2:1,80)             
  SORT FIELDS=COPY

That is essentially just a copy of the original F2.

In order to create a file for matched records, and a separate file for unmatched records, try this:
Code:

//S1     EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTJFN1 DD DSN=Input.File1
//SORTJNF2 DD DSN=Input.File2
//SORTOF01 DD DSN=Matched.Records
//SORTOF02 DD DSN=Unmatched.Records
//SYSIN    DD *
  JOINKEYS FILE=F1,FIELDS=(9,6,A,1,7,A)
  JOINKEYS FILE=F2,FIELDS=(1,6,A,7,7,A)
  JOIN UNPAIRED,F2                     
  REFORMAT FIELDS=(F2:1,80,F1:1,13)             
  SORT FIELDS=COPY
  OUTFIL FILES=01,INCLUDE=(81,13,CH,NE,C' '),BUILD=(1,80)
  OUTFIL FILES=02,SAVE,BUILD=(1,80)
/*

This will not include unmatched records from F1. If you also want those records, the above control statements will need to be modified accordingly.
Back to top
View user's profile Send private message
gkanswa

New User


Joined: 09 Feb 2009
Posts: 5
Location: Pune

PostPosted: Fri Mar 05, 2010 11:16 am
Reply with quote

Thanks a lot Alissa..!!

This is working for me ..

Hi Expat,
I will take your advise and will make sure will follow the same in all my future posts.
Thanks a lot..!!
Back to top
View user's profile Send private message
Vignesh Sid

New User


Joined: 04 Sep 2017
Posts: 43
Location: India

PostPosted: Wed Nov 08, 2017 9:48 pm
Reply with quote

Hi all,

This was also my requirement. The coding helped me too.

But additionally I have a query. I am getting the unmatch file as desired.

In match file, I want only one record which has "ACTION" starting from second position.

Is there any way to add a condition to the match file.

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: Wed Nov 08, 2017 10:29 pm
Reply with quote

A) Do NOT tailgate someone else's topic - there is a post in this topic that expressly says this and you ignored it.
B) Do NOT post to old topics.
C) Locked
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top