Dec 242017
 
QCMP compares two files, or two groups of files. It is not designed to isolate file differences, but simply to tell you whether or not files are identical.
File FCMP114.ZIP from The Programmer’s Corner in
Category File Managers
QCMP compares two files, or two groups of files. It is not designed to isolate file differences, but simply to tell you whether or not files are identical.
File Name File Size Zip Size Zip Type
QCMP.DOC 12649 4370 deflated
QCMP.EXE 7496 7231 deflated

Download File FCMP114.ZIP Here

Contents of the QCMP.DOC file


QCMP 1.14
---------

Purpose
-------
QCMP compares two files, or two groups of files. It is not
designed to isolate file differences, but simply to tell you
whether or not files are identical. This can be used to verify
file-by-file backup operations, for smart batch files, in
Personal REXX programs, etc. QCMP is similar to DOS's COMP
command except that (1) it doesn't display differences; (2) the
display is better suited for automated processing; and (3) it
returns a usable errorlevel.

Version 1.13 adds SHARE support but makes no other changes.

| indicates changes in recent versions.


Usage
-----
Here is the syntax for running QCMP:

qcmp filespec1 filespec2 [-Dn] [-H] [-T]

Usage is largely the same as DOS's COMP command except that
QCMP does not prompt for missing input, and the three option
switches are not found in COMP. The optional switches can be
introduced by either a hypen (-) or a slash (/).

Filespec1 can be any valid file or directory specification:

d: Drive only
path Path only
d:file.ext Drive, filename, extension
path\file.ext Path, filename, extension
d:path\file.ext Drive:path. filename, extension

If no drive is specified, the current drive is assumed. If no
path is specified, the current directory for the selected
drive is assumed.

If no filename is specified, "*.*" (all files) is assumed.

If no extension is specified, "*" is assumed. If you really
want to check a file that has no extension, use a single "."
with no extension. For example, "foo" is assumed to be "foo.*",
but "foo." matches only a file called "foo" (not "foo.txt").

Filespec2 is identical to filespec1 except that a missing
filename will default to the filename used in filespec1 rather
than "*.*".

Examples:

qcmp *.* b:
Compare all files in current directory of current drive
with files of the same name on drive B:

qcmp a: b:
Compare all files on drive A: to same files on drive B:.

qcmp \asm\*.asm b:*.bak
Compare all *.ASM files in \ASM directory of current
drive to files with same root name but .BAK extension on
drive B.


Display levels
--------------
The -D (Display level) switch affects the results messages that
are displayed. Valid display levels are:

-D0 No display; return errorlevel only.
-D1 Display results only for comparison errors
-D2 Display results for all files compared

The -D0 level is intended for batch files and Personal REXX
programs (or other programs that can execute QCMP and examine
the result code). The -D2 level is the default.


Checking the timestamp
----------------------
If two files have identical contents, QCMP will normally
consider them to be the same even if their dates or times
differ. However, if you use the -T switch, QCMP will also
compare the files' modification dates and times; if they are
different, the files are reported as being different, even if
their contents are the same.


Including hidden files
----------------------
If you want to include hidden files such as IBMBIO.COM in your
comparisons, add the -H switch. For example,

qcmp -h c:\*.* b:

would compare all of the files in the root directory of drive C
with copies on drive B, including hidden files (possibly,
IBMBIO.COM and IBMSYS.COM). Without the -H, hidden files would
not be included.


Results (display)
-----------------
For each matching file, QCMP will display the following line:

filespec1 - filespec2 > result

where FILESPEC1 and FILESPEC2 are the two files currently being
compared, and RESULT is the comparison result. RESULT is one of
the following:

OK Files are identical
ERROR Files are same size but not identical
SIZE DIFF Files are different sizes
READ ERROR Error reading one of the files.
DATE/TIME DIFF Files' timestamps are different (this
error reported only if -T selected)
NOT FOUND Named file not found

Note that the -D1 display level suppresses the display of files
for which the result is "OK".


Results (errorlevel)
--------------------
QCMP returns an errorlevel to DOS that describes the comparison
results. Errorlevel are as follows:

0 All files are identical (all "OK")
1 At least one comparison failed
254 No files found matching first filespec
255 Usage error, disk error, or insufficient memory

Note that if you specify the -d0 display level, ONLY the error
level is returned; there is no display at all. When -d0 is
specified, QCMP will terminate as soon as an errorlevel is
determined; for example, it will not bother to continue
comparing more files after one comparison fails, because the
errorlevel must be 1 regardless of the results of subsequent
comparisons.


Sample use: batch files
-----------------------
1. Branch to BACKUP if any *.ASM file in current drive is not
preperly backed up to B:*.BAK, else continue.

qcmp -d0 *.asm b:*.bak
If errorlevel 255 goto QCERR
If errorlevel 254 goto NOFILES
If errorlevel 1 goto BACKUP
... (all files OK)
...
:BACKUP
... (needs backup)
...
:NOFILES
... (no files match filespec1)
:QCERR
... (error in qcmp, or no matching files)
...

2. Back up any file in current directory that needs backup to
drive B. This requires two batch files, one called by the other
using the technique of executing another copy of COMMAND.COM
with the second batch file as a parameter.

BAK.BAT:
FOR %%a IN (*.*) DO command /c xxbak %%a

XXBAK.BAT:
qcmp -d0 %1 b:
IF NOT errorlevel 1 GOTO OK
echo Backing up %1
copy %1 b:
GOTO exit
:OK
echo %1 is backed up
:EXIT


Sample use: Personal REXX
-------------------------
1. Determine whether all files in current directory were
backed up successfully to drive b:

'qcmp -d0 *.* b:'
If rc = 0 Then
Say 'All files backed up OK'
Else If rc = 1 Then
Say 'Error in backup!'
Else If rc = 254 Then
Say 'No Matching files'
Else If rc = 255 Then
Say 'qcmp error!'

2. Create a list of files that need to be backed up from the
current directory of drive C to drive B, and back them all up.
The sample code assumes that STACKDRV and STACKMGR are
installed; without the STK device, the same could be accomplised
by redirecting output to a temporary file, reading the file line
by line, and then deleting the file.

'qcmp c: b: > stk'
If rc > 1 Then Do
Say 'Error invoking qcmp'
Exit
End

count = 0
Do While lines('stk') > 0
parse value linein('stk') with f1 ' - ' . ' > ' err
If err <> 'OK' Then Do
count = count+1
file.count = f1
error.count = err
End
End

If count = 0 Then
Say 'All files backed up OK'
Else Do i = 1 To Count
Say 'Backing up' file.i '(result = ' error.i')'
'copy file.i b:'
End

NOTE: after the WHILE loop, COUNT contains the number of compare
errors; FILE. contains an array of files not properly backed up,
and ERROR. contains the error text associated with FILE.
Indices to FILE. and ERROR. are the integers from 1 to COUNT.


Revision history
----------------
Version 1.14 - 01/23/91
File sharing support released
Internal changes

Version 1.13 - 09/11/89
Not released

Version 1.12 - 04/03/89
Added -H switch
Corrected improper parsing of ".." directory when ".."
evaluates to the root directory.

Version 1.11 - 07/23/88
Corrected case sensitivity of -T switch ("it's always
something" - R. Roseannadanna)

Version 1.10 - 07/06/88
Added -T switch.
Added default '*' extension
Protected from erroneous comparisons generated through use
of file pathing utilities or DOS's APPEND command.
Protected from disk read errors.
Allowed '/' as well as '-' for switch character and removed
position dependency of switches.

Version 1.00 - 11/11/86
First public release


Copyright/License/Warranty
--------------------------
This document and the program file QCMP.EXE ("the software") are
copyrighted by the author. The copyright owner hereby licenses
you to: use the software; make as many copies of the program and
documentation as you wish; give such copies to anyone; and
distribute the software and documentation via electronic means.
There is no charge for any of the above.

However, you are specifically prohibited from charging, or
requesting donations, for any such copies, however made; and
from distributing the software and/or documentation with
commercial products without prior permission. An exception is
granted to not-for-profit user's groups, which are authorized to
charge a small fee for materials, handling, postage, and general
overhead. NO FOR-PROFIT ORGANIZATION IS AUTHORIZED TO CHARGE
ANY AMOUNT FOR DISTRIBUTION OF COPIES OF THE SOFTWARE OR
DOCUMENTATION, OR TO INCLUDE COPIES OF THE SOFTWARE OR
DOCUMENTATION WITH SALES OF THEIR OWN PRODUCTS.

THIS INCLUDES A SPECIFIC PROHIBITION AGAINST FOR-PROFIT
ORGANIZATIONS DISTRIBUTING THE SOFTWARE, EITHER ALONE OR WITH
OTHER SOFTWARE, AND CHARGING A "HANDLING" OR "MATERIALS" FEE OR
ANY OTHER SUCH FEE FOR THE DISTRIBUTION. NO FOR-PROFIT
ORGANIZATION IS AUTHORIZED TO INCLUDE THE SOFTWARE ON ANY MEDIA
FOR WHICH MONEY IS CHARGED. PERIOD.

There is no restriction on the use of this software in
commercial or institutional environments.

No copy of the software may be distributed or given away without
this document; and this notice must not be removed.

There is no warranty of any kind, and the copyright owner is not
liable for damages of any kind. By using this free software,
you agree to this.

The software and documentation are

Copyright (C) 1986,1988,1989,1991 by
The Cove Software Group
Christopher J. Dunford
P.O. Box 1072
Columbia, Maryland 21044

(301) 992-9371
CompuServe 76703,2002 [IBMNET]

Personal REXX is a trademark of the Mansfield Software Group.


 December 24, 2017  Add comments

Leave a Reply