PDA

View Full Version : DOS Error Level Issue


Clouseau
22-Nov-2011, 02:40 PM
Hi Guys,

I am encountering an issue when I run Beyond Compare's quick compare. I have a batch file to return an errorlevel when two files are being compared (shown below). For the most it works really well and compares the files correctly. However, with some files it returns an error code telling me they are different when they are not. The files are quite large. The two text files in the code below being compare are around 14mb. Could this be an issue? I know they should seen as the same because when I launch BC and do a comparison there they are consider the same. What could be causing this? Your help is greatly appreciated. Unfortunately I am not able to attach any files since they are too big. If you would like some please let me know of another way to do this.

"C:\Program Files\Beyond Compare 3\BCompare.exe" /quickcompare=rules-based "P:\DavidTest\Files\Dump_Before\irt_dumppvP_irtbona rte_GMOPricerChangeRequest_20111021_115900.txt" "P:\DavidTest\Files\Dump_After\irt_dumppvP_irtbonar te_GMOPricerChangeRequest_20111021_115900.txt"
%errorlevel%
pause

Clouseau
23-Nov-2011, 07:13 AM
just one other question. if there are unimportant differences between the files will a errorlevel or 12 be returned or would it still return a differences errorlevel?

Aaron
23-Nov-2011, 10:41 AM
Hello,

It should return the 'correct' results when using the quick compare. You may need to use BComp.com instead of BCompare.exe, which will "wait" in order to return a code and may be necessary depending on how the automated task is structured.

Aaron
23-Nov-2011, 10:43 AM
Hello,

Files will be "similar" (12) if they consist of only unimportant differences. If there is at least 1 important difference, it will be marked as different instead.

Clouseau
23-Nov-2011, 01:11 PM
Hi,

Let me give you an example. Attached I have included an html report of a file that is being compared that shows no differences between the files and is returning an errorlevel of 13. Why would this be? If compared through the GUI it correctly shows that there are no differences.

Aaron
23-Nov-2011, 04:05 PM
Hello,

Do you see the same errorlevel results if you run /qc from the command line manually (outside of the automated process), and use bcomp.com /qc "file1" "file2", then:
echo %errorlevel%
?

Also, the screenshot is of a Data Compare report, but the file example given are of Text files, which would normally open in the Text Compare session type. Did you create a data compare file format that is associated with *.txt and automatically opens them in the Data Compare? If not, that may be a discrepency, since the Text Compare would not sort the data (but would align the lines), while a Data Compare would sort based on the default Key column (normally column 1).

Clouseau
24-Nov-2011, 06:50 AM
Hi Aaron,

I appreciate you sticking with me to resolve the problem.

Could the default comparison be the issue? The txt files that need to be compared should be done using a data compare that is set in my automation script. However, I don't have a default file formats set up to say the that it should be done when I run quick compare to return the error level. By default, does a quick compare use the default comparison within BC for a specific file format?

For example, if it is a text file will it automatically do a text comparison? If so, this could be the cause of the problem. A text comparison is done during the quick comparison which has errors and then when another comparison is done where a data compare report is specified there are no differences. How could I set it so that the quick comparison always does a data compare?

Clouseau
24-Nov-2011, 06:55 AM
Hi Aaron,

My appologies... In response to your first question, yes I still see the same results. But I think it may be what I have mentioned and what you were discussing in the second part of your response.

Thanks

Aaron
25-Nov-2011, 02:34 PM
Hello,

The type of session used is determined by your current defaults. To open text files in the Data Compare, for example, you would need to go to the Tools menu -> File Formats, make a new Data Compare format, and associate the file mask with "*.txt"

The topmost file format associated with *.txt will be the one used when the /qc is used (or any rules-based comparison).

*Please note, settings are stored per windows User account. The same user that runs the automated scripting will need to have it's settings changed. Settings are stored in each user's %AppData%\Scooter Software\Beyond Compare 3\ directory.

Clouseau
28-Nov-2011, 07:13 AM
Hi Aaron,

The solution worked great and I am no longer facing this issue. Thanks for all your help!