Need a compare logic to compare two files as below mentioned

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
suryavamsi62
Member
Posts: 1
Joined: Tue Jul 26, 2016 9:35 am

Need a compare logic to compare two files as below mentioned

Post by suryavamsi62 » Tue Jul 26, 2016 9:44 am

I am having the following files.

TEST FILE:
Acct num: 12345 Trancode : 481 Amt: 125
Acct num: 12345 Trancode : 488 Amt: 128
Acct num: 12345 Trancode : 488 Amt: 123
Acct num: 12345 Trancode : 482 Amt: 122

PROD FILE:
Acct num: 12345 Trancode : 481 Amt: 125
Acct num: 12345 Trancode : 488 Amt: 123
Acct num: 12345 Trancode : 482 Amt: 122

The extra record is 3rd one in TEST FILE.Iam saying so by manually checking the amount field.
The accounts are sorted with account number.

I want that to be written into separate file.

I have written normal file compare logic based on acct num.With this logic it is comparing first three records in both the files and writing the mismatches in Output file 1.It is considering the 4th record in TEST file as extra record and writing it to Output File 2, which is wrong.The 3rd record should be written to the output file2.

I have also tried to sort the trancode but have same trancode for extra record and original record.

Note: I have just given a example with acct num,Trancode,Amt fields.Originally my test and Prod files have 36 different fields.

Please ask quations for any more infio.

Post Reply

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



Other References
Mainframe Tools and others