|
View previous topic :: View next topic
|
| Author |
Message |
gkanswa
New User
.jpg)
Joined: 09 Feb 2009 Posts: 5 Location: Pune
|
|
|
|
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 |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| 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 |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| 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 |
|
 |
gkanswa
New User
.jpg)
Joined: 09 Feb 2009 Posts: 5 Location: Pune
|
|
|
|
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 |
|
 |
Vignesh Sid
New User
Joined: 04 Sep 2017 Posts: 43 Location: India
|
|
|
|
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 |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|