The Compare Journal Image 2 command provides a significantly better
approach to comparing journal images than the system CMPJRNIMG
command. Instead of comparing record images and packed data,
CMPJRNIMG2 provides field names and converted values. A selected set
of field names may be named or all fields in the record. CMPJRNIMG2
allows comparisons to be made when only after images exist (2 images
must exist for the same relative record number).
One to three ID fields must be named to help identify the record.
All records may be compared or a specific relative record number.
A typical command would be:
CMPJRNIMG2 FILE(xxx) IDFLDS(FLD1) CMPFLDS(FLD3 FLD5)
The named file must be journaled. The journal being used is
determined from the specified file and DSPJRN is used to create an
outfile of the journal entries. in QTEMP.
The file is sorted in sequence by:
Relative record number
For update entries, there must be two or more entries for a Relative
Record number in order to compare values.
** If IMAGES(*AFTER) was specified for journaling, there must be
two entries (UP) for the same relative record number in order
for a comparison to be made.
** If IMAGES(*BOTH) was specified for journaling, the update
before (UB) and update after (UP) images are compared.
The two rollback type entries (BR and UR) are bypassed.
Add (PT) and Delete (DL) entry types always print without any
comparison information. An option exists to list the detail field
changes for additions (see the ADDDTL parameter).
If the values of the two fields to be compared differ, a series of
lines is printed:
** Heading line for the 2nd Journal Entry information:
- Relative Record number
- Date and time of the journal entry
- Qualified job name
- User profile
** Lines for the 1st and 2nd journal entries which describe:
- Journal sequence number
- Type of journal entry and description
** Lines for each ID field you specified. There can be up to 3
fields to help you identify the record such as Employee Number
- Field name
- Value (packed or binary are converted)
** A line for the From Field and a line for the To field for each
field to be compared that differs.
- Field name
- Value (packed or binary data is converted)
Note that only the field values that differ are shown.
You can further limit the amount of output by requesting that one or
more of the following be selected:
- A specific Relative Record number
- A specific Program
- A range of dates and times
- A specific job or user
CMPJRNIMG2 can be helpful in problem determination. If you see bad
information in the data base and you are journaling the file, you can
help identify the program and user causing the error.
An alternate solution allows you to build the TAATMPJRNO file in
QTEMP using DSPJRN directly. See the section on 'Using DSPJRN
Use of Logical Files
Journaling of data only occurs to physical files.
When a data base change occurs thru a logical file and the physical
file is journaled, the system captures the image of the physical
file. The journal does keep track of which logical file was used to
cause a change. The journal entry does include the program name.
CMPJRNIMG2 only supports physical files and there is no information
provided for whether a logical file was used.
Identifying a Relative Record number in a Keyed file
If you have a keyed file and want to see the journal entries for a
specific Relative Record number, you may not have a program to assist
you in translating a key into a Relative Record number.
A tool to consider is DSPDB. Enter the following:
DSPDB FILE(xxx) FROMKEY(*YES)
You will see a prompt for the key fields in the file. After entering
the key, a single screen is displayed with the fields and values from
the record along with the Relative Record number in the upper right
hand corner of the display.
If there are duplicate keys, you can roll forward or backward using
the keyed access path.
After determining the Relative Record number you need information
for, you could enter CMPJRNIMG2 such as:
CMPJRNIMG2 FILE(xxx) IDFLDS(yyy) CMPFLDS(zzz)
and see the journal entries for the specific Relative Record number.
At least two update entries must exist for a comparison. DSPJRN does
not support selection by Relative Record number. The selection is
done when using the Sort function.
Comparison with the system command CMPJRNIMG
Both commands support similar selection criteria.
The system command provides only a record image of the differences.
There is no distinction as to where fields begin or end and packed or
binary data is not converted.
The CMPJRNIMG2 command allows you to:
- Specify field names to help you identify the record
- Allows a list of field names to be compared for
rather than the entire record
- Describes the field names and converts decimal data
CMPJRNIMG2 does not support the CMPOPT parameter. Journal entries
are compared regardless of whether you have *BEFORE or *AFTER images.
Using DSPJRN directly
In some environments you may want to use DSPJRN directly and multiple
times to create the specific information you want to analyze. For
example, you may only be interested in certain user profiles. This
can be effective if you are using both before and after images to
isolate particular situations.
You may use DSPJRN with OUTFILE(QTEMP/TAATMPJRNO) and OUTFMT(*TYPE3)
to create a file in QTEMP to be analyzed. Be sure to specify
ENTDTALEN with a long enough length to hold the largest record to be
compared. The maximum record length is 9000 bytes. ENTDTALEN(*CALC)
may be used if you are using only a single DSPJRN command. Then
specify RCVRNG(*QTEMP) when using CMPJRNIMG2. All other journal
receiver parameters (FROMENT, FROMTIME, TOENT, TOTIME) will be
If multiple DSPJRN commands are used, the entries for a specified
relative record number will not be in time sequence in the outfile.
When CMPJRNIMG2 is used, a sort occurs by timestamp within relative
record number to bring the entries into time sequence (the high order
keys are file, library, and member).
CMPJRNIMG2 escape messages you can monitor for
TAA9891 Selection criteria caused no records to be compared
Escape messages from based on functions will be re-sent.
Command parameters *CMD
FILE The qualified name of the physical file that is
being journaled. The library value defaults to
*LIBL. *CURLIB may also be used.
Journal entries caused by data base changes using
logical files cause the physical record image to be
IDFLDS A list of 1 to 3 fields that will be printed to
assist you in identifying the record. Only
character (type A), packed (type P), zoned decimal
(type S), binary (type B), date (type L), time (type
Z), and timestamp (type Z) fields may be specified.
The field length must be 50 bytes or less.
CMPFLDS A list of 1 to 10 fields that will be compared
between journal entries. The special value *ALL may
be used to compare all of the fields in the file.
If the field exceeds 250 bytes, only the first 250
Only character (type A), packed (type P), zoned
decimal (type S), binary (type B), date (type L),
time (type Z), and timestamp (type Z) fields may be
If *ALL is specified and the file contains a
non-supported type, the data is compared and an
indication of a difference will be noted, but only
the field name is printed and not the data.
MBR The name of the member in the file to be compared.
The default is *FIRST.
RCVRNG The receiver range to process. Two qualified names
may be entered for the Starting and Ending Journal
The Starting Journal receiver name defaults to
*CURRENT meaning the currently attached Journal
*CURCHAIN may be specified to mean the current
receiver chain. This has the same meaning as on
*QTEMP may be specified meaning that you have used
DSPJRN directly with OUTFILE(QTEMP/TAATMPJRNO) and
OUTFILFMT(*TYPE3). Be sure to specify ENTDTALEN
with a long enough length to hold the largest record
to be compared. ENTDTALEN(*CALC) may be used if you
are using only a single DSPJRN command or if you are
creating an outfile for the file with the largest
record length to be used in the analysis. The
OUTMBR parameter should specify *ADD for all but the
first output to the same member. This allows you to
build your own version of the outfile with multiple
DSPJRN requests such as bypassing certain programs
When *QTEMP is used, all other journal receiver
parameters (FROMENT, FROMTIME, TOENT, TOTIME) are
ignored. The outfile will be sorted by timestamp
within relative record number before processing (the
high order keys are file, library, and member).
The Ending Journal receiver defaults to blank
meaning the *CURRENT journal receiver. *CURRENT may
FROMENT The Starting Sequence number to be used when
converting the journal. The default is *FIRST. A
specific number may be entered if FROMTIME is not
FROMTIME The From Date and Time to be used when converting
the journal. The values default to blank meaning
use the FROMENT value. A specific date (job format)
and time may be entered if FROMENT is not specified.
TOENT The Ending Sequence number to be used when
converting the journal. The default is *LAST.
TOTIME The To Date and Time to be used when converting the
journal. The values default to blank meaning use
the TOENT value. A specific date (job format) and
time may be entered if *LAST is not used.
RCDNBR The Relative Record Number in the file to be
compared. The default is *ALL.
A specific relative record number may be entered to
compare only for a single Relative Record number.
ADDDTL A *YES/*NO option for whether to list the compare
field information for new records (additions).
*NO is the default to list only one line for a new
*YES may be specified to list all of the fields
described in the CMPFLDS parameter and their values.
JOB The Qualified Job Name of the journal entries to be
selected. The default is *ALL. If *ALL is not
used, either a fully qualified job name or a
partially qualified job name may be used.
You cannot enter just a user name. To select those
entries for a specific user, see the USRPRF
PGM The Program name of the journal entries to be
selected. *ALL is the default. If a specific name
is entered, only the journal entries caused by the
Program name will be selected.
USRPRF The User Profile name of the journal entries to be
selected. The default is *ALL. In some cases, the
name will differ from the user portion of the
Qualified job name.
You can use this parameter to select those journal
entries caused by a specific user profile.
JRN The Journal that should be used. The default is
*FILE meaning that the file named will be checked to
see what journal the file is journaled to.
A specific journal and library qualifier may be
used. The intent of this support is when you want
to compare journal images from a remote journal.
** To use the command you must be authorized to use DSPJRN for
the named file.
** See previous comments for the type of fields and lengths
** The record length of the file cannot exceed 9000 bytes.
** The number of fields in the file cannot exceed 998.
The following TAA Tools must be on your system:
CHKOBJ3 Check object 3
EXTLST Extract list
HLRMVMSG HLL Remove message
RTVDBFA Retrieve data base file attributes
RTVFLDA Retrieve field attributes
RTVFLDARR Retrieve field array
RTVPFJRNA Retrieve PF file journal attributes
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SORTDB Sort data base file
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CMPJRNIMG2 *CMD TAAJRNP QATTCMD
TAAJRNPC *PGM CLP TAAJRNPC QATTCL
TAAJRNPR *PGM RPG TAAJRNPR QATTRPG