Compare 2 files for the new records
Moderators: Frank Yaeger, Moderator Group
Compare 2 files for the new records
Hi,
I have a requirement where I need to compare 2 files(old and new) and for any new records in the new file I need to insert "NEW" in the first 3 columns and for rest of the records first 3 columns should be blank .
All the records in the new file should be as it is except NEW for new records.
Any help will be highly appreciated
I have a requirement where I need to compare 2 files(old and new) and for any new records in the new file I need to insert "NEW" in the first 3 columns and for rest of the records first 3 columns should be blank .
All the records in the new file should be as it is except NEW for new records.
Any help will be highly appreciated
Hello Abhin,
Welcome to the forum.
It can be easily done with 'SORT JOIN'. There are loads of samples for 'SORT JOIN' in this forum itself. Please have a search on that and try by yourselve. If you are facing any issue, you can very well get back to us with YOUR TRY.
Welcome to the forum.
It can be easily done with 'SORT JOIN'. There are loads of samples for 'SORT JOIN' in this forum itself. Please have a search on that and try by yourselve. If you are facing any issue, you can very well get back to us with YOUR TRY.
Guru:-)
You're never fully dressed without a smile
You're never fully dressed without a smile
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
As of now I am able to copy the records which are in F2 but not in F1 using the below code:
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,79,A)
JOINKEYS FILE=F2,FIELDS=(1,79,A)
JOIN UNPAIRED,F2,ONLY
SORT FIELDS=COPY
/*
but I need all the records from F2 with 'NEW' string in front of new records, can this be done in single step? its an URGENT requirement.. F1!!!!
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,79,A)
JOINKEYS FILE=F2,FIELDS=(1,79,A)
JOIN UNPAIRED,F2,ONLY
SORT FIELDS=COPY
/*
but I need all the records from F2 with 'NEW' string in front of new records, can this be done in single step? its an URGENT requirement.. F1!!!!
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Hi Bill, I did reply for your question as quoted above..Abhin wrote:@ Gurugars I am trying that..
@ Bill: I am comparing the data ,old file (F1) and new file (F2) If the data has changed and there are any new records in the new file , I should write 'NEW' in first 3 columns. I will keep rest of the file as it is .. both old and new..
Hi Bill, I did reply for your question as quoted above..Abhin wrote:@ Gurugars I am trying that..
@ Bill: I am comparing the data ,old file (F1) and new file (F2) If the data has changed and there are any new records in the new file , I should write 'NEW' in first 3 columns. I will keep rest of the file as it is .. both old and new..
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Hi
I am comparing the data , not any particular keys.
If data has changed and record is there in new file but not the old , I have to write 'NEW' in front of the new record .other matched records in new file will have just spaces instead of NEW.
New file
1
2
4
Old file
1
2
3
Output should be (All the records in new file but New in front of new record)
1
2
New 4
I am comparing the data , not any particular keys.
If data has changed and record is there in new file but not the old , I have to write 'NEW' in front of the new record .other matched records in new file will have just spaces instead of NEW.
New file
1
2
4
Old file
1
2
3
Output should be (All the records in new file but New in front of new record)
1
2
New 4
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page