The Compare Source command compares two source members and describes
the differences at a statement level. Only the statements that
differ are shown. Either a specific member or all members in a file
may be compared.
A typical command would be:
CMPSRC NEWFILE(xxx) NEWMBR(ABC) OLDFILE(yyy)
This would compare the ABC member in two different files.
If any differences exist, a spooled file is created. By default,
DSPSPLF is used and then the spooled file is deleted.
The output includes the sequence number, the source statement of the
statements which have changed and a 'Type' column which describes the
following:
Add = Added into the New member
Dlt = Deleted - does not appear in the New member
Chg = Changed in the New member
Asm = Assumed to be the statement in the Old member
that was changed
An option exists to suppress the printing of the changed or deleted
statements from the Old member.
The record lengths of the two files may differ.
Differences with other CMPSRC commands
--------------------------------------
CMPSRC2 is designed to determine only that members match or do not
match. It is also capable of comparing an entire source file (all
members). It is very useful when you want to ensure a subset of
members exist.
CMPSRC3 is an older form of CMPSRC. It prints the full version (all
source) from both members and indicates the changes.
Identifying the changes
-----------------------
CMPSRC will always flag any changes, but may not be able to correctly
identify the type of change (Add versus Change).
As the number of changes that have been made increases and the
proximity of the changes, additions, and deletions increases, CMPSRC
can make incorrect assumptions.
The maximum source file that can be compared is 240 bytes. If data
differs beyond the first 100 bytes of source, the source statement
prints along with an indication that the difference is beyond
position 100.
CMPSRC escape messages you can monitor for
------------------------------------------
TAA9891 Differences were found.
Escape messages from based on functions will be re-sent.
Command parameters *CMD
------------------
NEWFILE The qualified file name of the new source file. The
library value defaults to *LIBL. *CURLIB may also
be specified.
NEWMBR The new member name (or generic name) to be
compared. *ALL may be specified to compare all
members. If *ALL or a generic name is specified, a
summary spooled file is output.
OLDFILE The qualified file name of the old source file. The
file name defaults to *NEWFILE meaning the same file
name as the NEWFILE parameter. The library value
defaults to *LIBL. *CURLIB may also be specified.
OLDMBR The old member to be compared. The default is
*NEWMBR meaning the same name as the NEWMBR
parameter.
PRTOLDOPT An option to control the printing of the changed and
deleted statements from the Old member.
The default is *YES meaning both the changed and
deleted statements will be printed.
The value *NO causes no printing of the changed or
deleted statements.
The value *CHG allows only the changed statements to
be printed.
The value *DLT allows only the deleted statements to
be printed.
DSPSPLF An option to determine whether DSPSPLF should be
used if CMPSRC finds changes.
For either *YES or *NO, if no changes are found, a
completion message is sent without a spooled file
being created.
*YES is the default and uses DSPSPLF to display the
spooled file. The spooled file is automatically
deleted when you end DSPSPLF. *YES may only be
specified in an interactive job.
*NO causes the spooled file to be output for later
printing or displaying.
STRSTMT The statement number to begin the comparisons of
both source members. The default is 1 meaning begin
at the first record in each source member.
A specific number may be entered to begin the
comparisons after record 1. A relative record
number (not a source sequence number) must be used.
The number must be less than the number of records
in both source members.
ENDSTMT The statement number to end the comparisons of both
source members. The default is *END meaning end at
the last record in each source member.
A specific number may be entered to end the
comparisons before the last record. A relative
record number (not a source sequence number) must be
used. If a number is entered which is greater than
the number of records in the member, no error
occurs.
ENDSTMT The statement number to end the comparisons
TITLE2 A 50 byte value that may be used to replace the
normal heading for the CMPSRC listing. *NONE is the
default meaning to use the normal CMPSRC heading.
The TITLE2 parameter and additional parameters (such
as MBR2) are intended to be used by the CMPSRCARCM
command. They may be used for other purposes when
the source being compared does not exist in the
original members.
MBR2 The value to be placed in the New Member field on
the listing. *NONE is the default meaning to use
the NEWMBR value.
MBR3 The value to be placed in the Old Member field on
the listing. *NONE is the default meaning to use
the OLDMBR value.
FILE2 The value to be placed in both the New File and Old
File fields on the listing. *NONE is the default
meaning to use the NEWFILE and OLDFILE values.
LIB2 The value to be placed in both the New Library and
Old Library fields on the listing. *NONE is the
default meaning to use the NEWFILE and OLDFILE
library names.
CHGDAT2 The value to be placed in the New change date and
change time fields on the listing. *NONE is the
default meaning to use the change date of the NEWMBR
member. If a value is entered it should be in the
format of CYYMMDDMMHHSS.
CHGDAT3 The value to be placed in the Old change date and
change time fields on the listing. *NONE is the
default meaning to use the change date of the OLDMBR
member. If a value is entered it should be in the
format of CYYMMDDMMHHSS.
Restrictions
------------
** Only source files may be specified.
** The maximum length of the source file (including the date and
sequence number) that can be compared is 240 bytes (a maximum
of 100 bytes for the statement portion).
** A maximum of 30,000 statements may exist in a source member.
** It is invalid to compare a member that has zero records.
Prerequisites
-------------
The following TAA Tools must be on your system:
HLRMVMSG HLL remove message
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CMPSRC *CMD TAASRDM QATTCMD
TAASRDMC *PGM CLP TAASRDMC QATTCL
TAASRDMR *PGM RPG TAASRDMR QATTRPG
TAASRDMR2 *PGM RPG TAASRDMR2 QATTRPG
|