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

Compare two files and write only new record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Thu Jul 03, 2014 4:31 pm
Reply with quote

Hi,

I have two files of same LRECL. First position in both the files is space. I have to compare two files and write only those records that are new records present in second file and not the updated ones. Also, I need to insert 'D' at first position for all the additional records. Note: there are no key common to both these files.

Example

File 1:

11111AAAA
11111BBBB

File 2:

11111AAAA
11111BBCC
22222CCCC


Output should contain only
D22222CCCC

I am using UNPAIRED,F2,ONLY in JOINKEYS but it gives me the updated records as well. However I just need if there are any additional records in the file.

Please help me out. Thanks
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Jul 03, 2014 4:55 pm
Reply with quote

These two statements contradict each other.

Quote:
Note: there are no key common to both these files.

but it gives me the updated records as well.


If there is no key, and you are using the entire record for your sort/join, then the second record on file 2 is a NEW record.

If you were to Join columns 1,6 then it would solve the issue for the data presented.
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Thu Jul 03, 2014 5:03 pm
Reply with quote

Hi Dave,

Yes in this case second record will be new record but since some of its character matches with the previous file at same position hence I would not want this in the output file.
I am using the entire record for sort/join and this results in the second record coming in output file along with the third record. My requirement in this example to get the 3rd record only in output.
Thanks.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Jul 03, 2014 5:11 pm
Reply with quote

From what I know, Joinkeys is not able to deal with:

Quote:
some of its character matches with the previous file at same position hence I would not want this in the output file.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 03, 2014 5:32 pm
Reply with quote

Can you provide better sample data? You either have a key or you don't. If you don't, don't make it look like you have.

What might your input files look like if you had three records on your output?
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top