PrestoSoft Blog :: Home

Sunday, September 09, 2012

Comparing COBOL Files with ExamDiff Pro

ExamDiff Pro makes it very easy to compare COBOL files by allowing you to ignore comments. In COBOL files, if an asterisk is in position 7 of a line, then the rest of the line is a considered a comment. This rule can be expressed in the following regular expression: (?<=^.{6})\*.*?\n

Let's use it to define a new COBOL document type: go to Options | Document Types, click on New, enter "COBOL" as the type name and "cbl" as the extension (you can have more than one extension there), and type our regular expression for comments: 

 

After you click OK and compare two COBOL files, their comments will be ignored (don't forget to check the Ignore Comments checkbox under Options | Text Compare).

Bonus tip: If your files have numbers with leading zeroes (e.g. 00008) in one file and without (e.g. 8) -- in the other file, you will get much better comparison results if you ask ExamDiff Pro to ignore zeros that precede other digits. The following regular expression will do the job: \b0*(?=\d). You need to enter it in the Ignore parts of each line | Parts matching regular expression edit box in Options | Text Compare:
 

Labels: ,