comapring two files

In this Mainframe Forum - You can post your queries on FILE-AID tool

Moderators: Anuj Dhawan, Moderator Group

Post Reply
Posts: 2
Joined: Fri Feb 06, 2009 11:16 pm

comapring two files

Post by Migul » Wed Feb 11, 2009 2:19 am

Can anyone please help me with this query..I am new to all this utilities ..Can you please help me with example of code.

I have two input file each of FB and Record length of 80 as below
File 1
file 2
I want to comapre the record in file 1 starting at 1 with the record in file2 starting at 12 and if both are equal then send that record to output file. So in this case the output file should be

Output file

How can I get this done in batch command.
Can i use compare if yes how??

please help me I really need this code.

Thanks in advance

Posts: 2
Joined: Tue Mar 03, 2009 8:36 am

Post by sharadgarg123 » Tue Mar 03, 2009 8:45 am

U can compare two files by going to the ISPF menu and selecting the option of Compare( 10) from there and additionally u can set the selection criteria for recordsets that have to be compared.

Dave E
Posts: 9
Joined: Thu Jun 25, 2009 6:01 pm

Post by Dave E » Tue Jul 14, 2009 5:55 pm


File-AID/MVS has got a very powerful Compare function built-in. You can actually use you record layouts (COBOL or PL/1) and tell File-AID to compare specific fields. For example, if the 1111111 that you mentioned was a customer-id field in one file and a cust-id field in the other file, you can tell File-AID to compare the two fields, even if they are at different offsets within their respective record layouts.

The output criteria allows you to copy the entire record (from any of the input files) to another file. You are able to extract records based on whether the records matched, were deleted, were inserted or simply changed.

Once you use this compare you will never want to use the ISPF compare utility.

Good luck.
Dave E
Software Engineer

Post Reply


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.
Mainframe Interview questions

Other References
Mainframe Tools and others