The Compare Source 2 command compares:
** Two members from the same or different files.
** A generic set of members or all members in one file against
the corresponding member names in another file.
Only the data portion of the source statements are compared (not the
sequence number or date of last change).
CMPSRC2 differs from the TAA tool CMPSRC in that by default no
printed output occurs for a single member comparison. An escape
message is sent if the members do not match. The escape message
includes the first statement that was found that differs in the
FROMFILE. If there are many differences or the differences are not
obvious, the CMPSRC command can be used.
The CMPDTLDIFF parameter on CMPSRC2 allows a detail member comparison
of the members that do not match by the use of CMPSRC.
If a set of generic members or all members in a file are compared, a
printed listing occurs with one line per member. If there is a
difference, the first statement that differs is provided. The
CMPDTLDIFF parameter controls whether a detail comparison is made for
any members that differ.
To compare all source files in a library, see the CMPSRC4 or
A typical command to compare one member would be:
CMPSRC2 FROMFILE(QCLSRC) FROMMBR(MBR1) TOFILE(QCLSRC2)
A typical command to compare all members in a file and print a detail
listing of any differences would be:
CMPSRC2 FROMFILE(QCLSRC) FROMMBR(*ALL) TOFILE(QCLSRC2)
If the FROMMBR has excess statements, each excess statement is
considered an error. If the TOMBR has excess statements, all excess
statements count as a single difference. If the TOFILE does not have
a corresponding member, an error is indicated.
If the TOFILE has more members than the FROMFILE, an option
(CNTTOFIL) determines the handling. By default, it is not
considered. If CNTTOFIL(*YES) is specified, the members in the
TOFILE are counted and an error occurs if there is not a match.
The source files can be up to 240 bytes in length.
If an unmatched condition occurs, TAA9896 is sent as an escape
The CMPSRC2 command defaults to provide a listing without an outfile
by using OUTLIB(*NONE). An output library may be named for the
CMPSRCP file. To see the fields described for the file, use DSPTAA
The CSRES (result of compare) field will contain one of the following
- *MATCH The From member matches the To member
- *UNMATCH The From member does not match the To member
- *NOTOMBR No corresponding To member exists
- *NOTOMBRS No members exist in the To file
- *NOFRMMBR No member in the From file
- *NOFILE The named To file does not exist
- *NOTAUTH The user is not authorized to the To file
Command parameters *CMD
FROMFILE The qualified name of the FROM source file to be
compared. The library defaults to *LIBL.
FROMMBR The member to be compared. A single member name may
be used, a generic name, or the special value *ALL
to compare all member names.
TOFILE The qualified name of the TO source file to be
compared. The file name defaults to *FROMFILE. The
library defaults to *LIBL.
TOMBR The member to be compared to in the TO file. The
default is *FROMMBR.
CMPDTLDIFF A *YES/*NO value that determines if a detail
comparison will be made if any members differ.
*NO is the default meaning no detail comparison is
made and only the first statement that differs is
*YES may be specified to print a detail listing
using CMPSRC for any members that differ.
CNTTOFIL A *YES/*NO value that defaults to *NO. *YES may
only be specified when FROMMBR(*ALL) is specified.
*NO avoids the determination of how many members
exist in the TOFILE. This is intended for the case
where you are comparing a subset of the members to
ensure that they match the TOFILE corresponding
members. Excess members in the TOFILE are ignored.
DLTSPLF A *YES/*NO value that determines if the spooled file
is deleted if a 100% match exists.
*NO is the default to retain the spooled file.
*YES may be specified to delete the spooled file.
if a 100% match exists.
BYPCOPYRGT A *YES/*NO value that defaults to *NO. *NO causes
every statement to be compared.
*YES is intended for the case when TAA source is
being compared for different versions and the
copyright statement may have changed. If *YES is
specified and the string COPYRIGHT appears in the
first 10 records of the corresponding statements
from both members, the statement is bypassed.
OUTLIB The library in which the CMPSRCP file will be
placed. The default is *LIBL. If the CMPSRCP file
does not already exist, a library must be specified.
OUTMBR The member of the CMPSRCP file to be used. If the
member does not exist, it is added. The default is
REPLACE A *YES/*NO value for whether the member should be
cleared before writing records into it. The default
*NO may be specified to add records to an existing
CMDNAM The command name to use in the output. CMPSRC2 is
the default. If CMPSRC2 is invoked from CMPALLSRC,
the name used is CMPALLSRC.
Both files must be source file types.
Valid data must exist in the sequence number field.
The following TAA Tools must be on your system.
CHKGENERC Check generic
EDTVAR Edit variable
HLRMVMSG HLL Remove message
RTVDBFA Retrieve data base file attributes
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CMPSRC2 *CMD TAASRCR QATTCMD
TAASRCRC *PGM CLP TAASRCRC QATTCL
TAASRCRR *PGM RPG TAASRCRR QATTRPG
TAASRCRR2 *PGM RPG TAASRCRR2 QATTRPG
TAASRCRR3 *PGM RPG TAASRCRR3 QATTRPG
TAASRCRP *FILE PF TAASRCRP QATTDDS