FCOPY Reference Manual (32212-90008)

Chapter 5 67
FCOPY Functions
COMPARE
COMPARE
Compares the contents of the fromfile with the contents of the tofile, record by record,
without changing either file.
Syntax
;COMPARE [=
number-of-errors
]
Where:
number-of-errors
Is an integer designating the number of mismatches after which
FCOPY should terminate. The default value is 1.
File Attributes
The fromfile and the tofile must both have read access. The tofile record size must be equal
to that of the fromfile, or else both files must have variable-length records.
Operation
The two files may reside on any device, but their record characteristics (record size, record
format, and record type) must be identical.
Each time FCOPY detects an error during file comparison, it prints a message on the
standard listing device (your terminal during a session or a printer during a job). The
message shows the number of the record in the fromfile in which the error occurred.
Restrictions
The only FCOPY functions that can be used with COMPARE are SUBSET, SKIPEOF, and
IGNERR.
Examples
In the example below, FCOPY compares the contents of the disk file FILEA with the
contents of the disk file DUP1. If it finds a mismatch, FCOPY prints a message on the
standard listing device (your terminal during a session, or a printer during a job) and
terminates the operation.
>FROM=FILEA;TO=DUP1;COMPARE
In the next example, FCOPY compares the contents of the first file on the magnetic tape
TAPE4 with the contents of the disk file DUP2. Each time it finds a mismatch, FCOPY prints
a message on the standard listing device. FCOPY terminates the operation after the fifth
mismatch.
>FROM=TAPE4;TO=DUP2;COMPARE=5