Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compare and write non-matching records to output file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
monasu1998

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Thu May 02, 2013 7:48 pm    Post subject: Compare and write non-matching records to output file
Reply with quote

Hi,

I want to compare 2 files and write the records those are in file 1 but not in file to a output file.

Could someone help with a code snippet please?

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

Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 989
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu May 02, 2013 7:55 pm    Post subject:
Reply with quote

Google SUM FIELDS=NONE

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

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Thu May 02, 2013 7:59 pm    Post subject:
Reply with quote

Hi Garry,
SUM FIELDS=NONE will only remove the duplicates I mean the 2nd occurances.. I donot want the record in output if exists in both the files.

Thanks,
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu May 02, 2013 8:06 pm    Post subject: Reply to: Compare and write non-matching records to output f
Reply with quote

search the forum,
there are gazillions of examples doing it using JOINKEYS
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 989
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu May 02, 2013 8:08 pm    Post subject:
Reply with quote

Are the 2nd occurrences not duplicates???

You might want to use JOINKEYS which enables you to select records which are only in File1, only in File2 or are in both.


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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu May 02, 2013 8:17 pm    Post subject: Reply to: Compare and write non-matching records to output f
Reply with quote

Largely butchered from an example today. You'll need to change your keys, and explain better if this is not what you want. If your input(s) are not sortted, you'll need to remove the SORTED,NOSEQCK.

Code:
  JOINKEYS FILE=F1,FIELDS=(1,3,A),SORTED,NOSEQCK
  JOINKEYS FILE=F2,FIELDS=(1,3,A),SORTED,NOSEQCK
  JOIN UNPAIRED,F1,ONLY
  OPTION   COPY


The output will be on SORTOUT.
Back to top
View user's profile Send private message
monasu1998

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Thu May 02, 2013 8:21 pm    Post subject:
Reply with quote

Hi Garry,

I am glad that you are trying to help me with a solution. But I donot want any of those occurances. I just need that is in 1 and not in 2.

background: I am doing some testing where in in my test run there should be few records less from the requirements from business. Now Business wants me to send a file with just what has been removed.
I am comparing the prod vs test file.

Note: Both the files are sorted with same key.

Thanks,
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 989
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu May 02, 2013 8:24 pm    Post subject:
Reply with quote

Mishra,

Bill's job suitable changed for the FIELDS= values should do what you want. You will want FIELDS=(1,lrecl,A) where lrecl matches the LRECL of your records.

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

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Thu May 02, 2013 8:38 pm    Post subject:
Reply with quote

Hi Garry,

I'm close to the result.

I used
JOINKEYS FILES=F1,FIELDS=(1,66,A)
JOINKEYS FILES=F2,FIELDS=(1,66,A)
JOIN UNPAIRED,ONLY,F1
OPTION COPY

what I see in the sortout is the records those are common in both the files. But not the ones which are removed in my test file.

Just need to reverse the sort card so that the diff comes in sortout..

Thanks,
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu May 02, 2013 8:45 pm    Post subject: Reply to: Compare and write non-matching records to output f
Reply with quote

Did you typo F1,ONLY to ONLY,F1?

The example show should give you all records which are on file 1, but not on file 2, based on the key you provided.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu May 02, 2013 8:54 pm    Post subject:
Reply with quote

Hi Mishra,

check this link for a better understanding.
Back to top
View user's profile Send private message
monasu1998

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Thu May 02, 2013 8:57 pm    Post subject: Re: Reply to: Compare and write non-matching records to outp
Reply with quote

Hi Bill,

yes, that was a typo. But changing that is not giving me correct result..

SORTJNF1 is the prod file with records 651911
SORTJNF2 is the test file with records 650933

I want the 978 records which are in prod and not in test in the sortout file.

With the current following sort card,

JOINKEYS FILES=F1,FIELDS=(1,66,A)
JOINKEYS FILES=F2,FIELDS=(1,66,A)
JOIN UNPAIRED,F1,ONLY
OPTION COPY

all the reocrds from the prod file is written to sortout. which is not I want..

Thanks,
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu May 02, 2013 9:12 pm    Post subject: Reply to: Compare and write non-matching records to output f
Reply with quote

Well, show some sample data (masked, if necessary) the key field should be enough. RECFM and LRECL of both input files.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 02, 2013 11:31 pm    Post subject:
Reply with quote

Hello,

Show some sample values from both files. If a file can have duplicates, show some duplicates in your sample data.

Show the output you want from the sample data you post.

Only the "match" keys need to be shown - not the rest of the data, unless it is needed for the selection.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us