TAA Tools
CRTDBFJRN       CREATE DBF WITH JOURNAL FIELDS         TAAJRNU

The Create  Data Base file  with Journal Fields  command allows you  to
create  an  externally   described  file  that  contains  the  standard
journaling  fields (such  as the user,  date, RR number)  and the field
names from  a  file that  is being  journaled.   The  new  form of  the
command uses the  DSPJRN outfile to output records to  the file.  PRTDB
(simple  listing of named  fields) or PRTDBS  (allows select/sort also)
could be used to process the entries.

The old form of the command  is CRTDBFJRN2 which creates the file,  but
does not do  DSPJRN.  See the  instructions for how to  use CRTDBFJRN2.

The  normal use of  the system DSPJRN  command provides a  single field
(JOESD) with the image of  the data base record.   You can process  the
outfile, but  you must  write a  program that handles  the data  within
your record image in a program described manner.

To use CRTDBFJRN,  the existing data base file  must be a physical file
that is being journaled.

Using  the CRTDBFJRN function allows you  to analyze the results with a
Query or  a program.   You  may want  to consider  the CMPJRNIMG2  tool
also.  CMPJRNIMG2  will allow you to print  specific field comparisons.

The  user  must have  at  least *USE  authority  to the  file  and *USE
authority  to  the  journal  used   by  the  file.    If  the   default
INZDLTDFT(*YES) is  used and the  file is specified  as IMAGES(*AFTER),
the user must have both *OBJMGT and *OBJOPR to the file.

A typical CRTDBFJRN command would be:

             CRTDBFJRN   FROMFILE(FILEA)

CRTDBFJRN would  create a temporary source file in  QTEMP.  The DDS for
the QADSPJR2 model file in QSYS  used by DSPJRN would be retrieved  and
the  JOESD  field  (entry  data)  deleted.    By  default,  the  *TYPE2
OUTFILFMT is used.

The  DDS  for FILEA  would  be retrieved  to  a separate  member.   Any
comments  are deleted and any file and  record level keywords.  The 'K'
(Key  fields) specifications  (and  any  following  records)  would  be
deleted.

The  modified DDS for  FILEA would  be added  to the  modified QADSPJR2
retrieved source  and the To file created.   Note that the To file will
not have any key fields.  The  default for the To file is TAAJRNDBF  in
QTEMP.

DSPJRN is  then used  to output  to a  temporary file  in QTEMP.   CPYF
with  FMTOPT(*NOCHK) is  then used  to  copy the  DSPJRN output  to the
created To file.

The default  provides  for  initialization  of  the  data  for  the  DL
(deleted after  image) journal entries  if IMAGES(*AFTER)  is specified
for journaling as  opposed to blank values as  output by DSPJRN for the
JOESD   field.    The  decimal   fields  will  contain  zeros  allowing
processing of the output  without concern for decimal data errors.   If
IMAGES(*BOTH) are specified, no change occurs to the DL entries.

The  file is then  ready to  be processed.   If  TAAJRNDBF in  QTEMP is
used,  the file  is deleted first.   After  the output  occurs, you may
copy the file to a permanent library.

Using MINENTDTA for a journal
-----------------------------

The Minimize Entry  Data function causes  primarily the changed  fields
to  be captured  in  the journal  entry.   Therefore,  if CRTDBFJRN  is
used, the  output records will tend to have  many fields with blanks or
zeros.

Depending on what you are  trying to do with  the outfile may make  the
MINENTDTA function incompatible with CRTDBFJRN.

However, in a  simple case where you  are comparing a before  and after
image  of   the  same  relative  record,  the   information  should  be
adequate.

Data mapping errors
-------------------

For  most types of entries,  no data mapping errors  will occur.  There
are some  conditions where  this can  occur.   An example  is when  the
file  contains  date  and/or time  fields  and  a  delete occurs  of  a
previously  deleted record.    In this  case, the  data fields  will be
blank and  CRTDBFJRN  will  fail  with a  data  mapping  error  because
blanks are invalid in such a field.

If you  are having  data mapping  errors, check the  entries to  see if
you have  valid data in 'entry specific data'.   If invalid entries are
all for a specific type (such as  DL), it is possible to use the  ENTYP
parameter and name the types that are valid to convert.

In some cases it may  be possible to use CRTDBFJRN2 and  have a program
that deletes the  records which are causing an  error before the use of
CPYF.

CRTDBFJRN  escape messages you can monitor for
----------------------------------------------

      CPF9898    Sent for various error conditions (not a physical
                   file, not being journaled, etc)

Escape messages from based on functions will be re-sent.

Using CRTDBFJRN2
----------------

CRTDBFJRN2 is the old form of the tool.  It only creates the file.

After  the  new file  is created,  you must  use  DSPJRN to  output the
records from the journal.  This is a two step process:

       - Use DSPJRN to output to a file in QTEMP
       - Use CPYF to copy to the file created by CRTDBFJRN
           specifying FMTOPT(*NOCHK)

You must  be careful with  the specifications as  no check occurs  that
you are  generating the  correct data  base records.   You must  do the
following:

  **   Name  the  journal  where  the file  to  be  processed  is being
       journaled.

  **   Specify JRNCDE =  R.  These  are the Record  image entries  that
       are captured in  the journal.  No other JRNCDE  values should be
       used.

  **   Specify  OUTFILFMT  =  *TYPE2.    This  is  the  format  of  the
       QADSPJR2 model file that is used to retrieve the DDS from.

  **   Specify the name of  a temporary file in  QTEMP for the  OUTFILE
       parameter.

The DSPJRN command to use for the previous example would be:

             DSPJRN        JRN(yyy) FILE(xxx/FILEA) +
                             JRNCDE(R) OUTPUT(*OUTFILE) +
                             OUTFILFMT(*TYPE2) OUTFILE(QTEMP/TMPOUTP)

This will default to output all records for the file.

  **   Use CPYF to copy to the file created by CRTDBFJRN.

             CPYF          FROMFILE(QTEMP/TMPOUTP) +
                             TOFILE(xxx/FILEA) MBROPT(*ADD) +
                             FMTOPT(*NOCHK)

       Depending on your  file length, you  may see messages  from CPYF
       regarding truncation.

The  new file  is now  ready to  be read.    You can  perform selection
within  a query.  You  may also want to  perform selection on DSPJRN to
minimize the  number  of records  written  by using  the JOB,  PGM,  or
USRPRF parameters on DSPJRN.

If the  file being journaled  has more than  a single member,  you will
probably  want  to specify  that  the records  for a  single  member be
output (specify the member  name as part of  the FILE parameter on  the
DSPJRN command.

Querying the file after data is written to it
---------------------------------------------

If you just want to print the data, use PRTDB.

             PRTDB2        FILE(TAAJRNDBF)

If you want to select/sort and print the file, use PRTDBS.

             PRTDBS        FILE(TAAJRNDBF)

You may be interested in sequencing or selecting on the following:

       JODATE   -  Date of entry (job date format)
       JOJOB    -  Job name that caused the entry
       JOUSPF   -  User name that caused the entry
                      JOUSER may also be used for most cases
       JOPGM    -  Program name that was used to cause the entry
       JOCTRR   -  Relative record number
       xxx      -  One of your field names (such as selecting a value)

You can use  the TAAQRY tool for  simple requests.  A  Query product or
writing a specific program could be used for more complex requests.

CRTDBFJRN Command parameters                          *CMD
----------------------------

   FROMFILE      The  qualified  name of  the  data base  file  that is
                 being journaled.   It must  be a physical  file.   The
                 library  value  defaults  to  *LIBL.    *CURLIB  or  a
                 specific library may also be used.

   FROMDATE      The  date and time  of the  first journal entry  to be
                 considered.   The default  is *FIRST to  use the first
                 journal entry in the receiver range.

                 The special  value  *CURRENT may  be  entered to  mean
                 today's date.

                 A specific date  may be entered in job  format.  If no
                 date is entered, a date of Jan 1, 1940 is used.

                 A  specific time may be entered  in HHMMSS format.  If
                 no time is entered, a time of 000000 is used.

   TODATE        The date  and time  of the  last journal  entry to  be
                 considered.  The  default is *LAST to  use the current
                 date  and  the  last  journal  entry  in the  receiver
                 chain.

                 A specific date may be entered  in job format.  If  no
                 date is entered, the current date is used.

                 A specific time may  be entered in HHMMSS format.   If
                 no time is entered, a time of 235959 is used.

   FROMMBR       The  member  of   the  From  file  to  be  considered.
                 *FIRST  is the  default.   *LAST or  a specific member
                 may be specified.

   TOFILE        The qualified name of the  To file to be output.   The
                 default  is TAAJRNDBF  in QTEMP.   If  the  default is
                 used,  an existing  file of  the same name  is deleted
                 first to ensure a correct definition.

                 A specific file name in  QTEMP or a permanent  library
                 may be entered.  If so, the file must not exist.

   OUTFILFMT     The outfile  format to be used.   The value  is passed
                 thru to the DSPJRN command.

                 *TYPE2  is the  default.   *TYPE1, *TYPE3,  *TYPE4, or
                 *TYPE5 may also be specified.

   ENTTYP        The  entry  type  to  be  considered.    *RCD  is  the
                 default for record types.

                 A  list  of  specific  entry   types  may  be  entered
                 including:

                  BR    Before image
                  DL    Deleted record
                  DR    Record deleted for rollback
                  PT    Record added to physical file
                  PX    Records a RRN in a physical file
                  UB    Before image
                  UP    After image
                  UR    After image of a record updated for rollback

   RCVRNG        The  receiver range to  process.  Two  qualified names
                 may  be entered  for the  Starting and  Ending Journal
                 receiver.

                 The  Starting  Journal   receiver  name  defaults   to
                 *CURCHAIN  meaning   the  current  journal   chain  of
                 receivers.    *CURRENT may  be specified  to  mean the
                 current receiver.  Both  values have the same  meaning
                 as on DSPJRN.

                 A specific journal receiver may be named.

                 The  Ending   Journal  receiver   defaults  to   blank
                 meaning  that *CURCHAIN will  be used.   *CURRENT or a
                 specific journal receiver may be specified.

                 If a specific  starting journal receiver  is named,  a
                 specific ending journal receiver must be named.

   INZDLTDFT     A  *YES/*NO  value  for  whether   to  initialize  the
                 values  for the  deleted records  (record type  DL) if
                 IMAGES(*AFTER)  is specified  for the  journaled file.

                 If  IMAGES(*BOTH)  is  specified  for   the  journaled
                 file,  the  INZDLTDFT  parameter  is ignored  and  the
                 output  record will contain  the values  of the record
                 before it was deleted.

                 *YES is the default to  initialize the DL records  for
                 IMAGES(*AFTER)  type files  so  that  valid data  will
                 exist.   Decimal fields will contain  zeros.  You must
                 have both *OBJOPR and  *OBJMGT to use  INZDLTDFT(*YES)
                 when the file is specified as IMAGES(*AFTER).

                 *NO  provides a  compatible interface  to  the use  of
                 the command  prior to July 15, 2010.   All data in the
                 user  fields are  initialized to  blanks as  exists in
                 the  JOESD   field  of   the  DL   journal  entry   if
                 IMAGES(*AFTER) exists for the journaled file.

   GENLVL        Specifies   the   severity   level  of   messages   to
                 determine  if  the create  fails.    It must  be  in a
                 range of 0 - 30.

                 20 is the default.

CRTDBFJRN2 Command parameters                         *CMD
-----------------------------

   DBF           The qualified  name  of the  data  base file  that  is
                 being journaled.   It  must be a  physical file.   The
                 library  value defaults  to *LIBL.   *CURLIB  may also
                 be used.

   NEWFILE       The qualified  name  of  the new  file  that  will  be
                 created  by  the   command.    It  will   contain  the
                 QADSPJR2 fields  (without JOESD).  Added  to this will
                 be   the  fields  from  the  file  named  in  the  DBF
                 parameter (without  comments,  record level  keywords,
                 key  fields, etc).   The  file  must not  exist.   The
                 library value defaults to *CURLIB.

                 Once  the file  has been created,  it may  be used for
                 different uses with DSPJRN.   See the tool  discussion
                 for how to  specify the DSPJRN and  CPYF commands when
                 writing to this file.

   SRCFILE       The  qualified  name  of  the  source  file that  will
                 contain the combined  DDS from QADSPJR2  and the  file
                 named in  the  DBF parameter.   The  default is  *TEMP
                 meaning that  a source file will be  used in QTEMP and
                 you do not want to retain the generated source.

                 If  a specific source  file is named,  a blank library
                 name will be  assumed to be  *LIBL.  *LIBL or  *CURLIB
                 may also be entered.

Restrictions
------------

The file named must be a physical file and must be journaled.

The  user must  have  at least  *USE  authority to  the  file and  *USE
authority   to  the  journal  used  by  the   file.    If  the  default
INZDLTDFT(*YES) is used  and the file  is specified as  IMAGES(*AFTER),
the user must have both *OBJMGT and *OBJOPR to the file.

The RTVPFSRC command is  used to simulate the DDS  used for your actual
file.  RTVPFSRC has some restrictions.

See the previous comments relative to data mapping errors.

Prerequisites
-------------

The following TAA Tools must be on your system:

     CHKMBR2         Check member 2
     CHKOBJ2         Check object 2
     CHKOBJ3         Check object 3
     EDTVAR          Edit variable
     EXTLST2         Extract list 2
     RTVDBFA         Retrieve DBF attributes
     RTVOBJJRNA      Retrieve object journal attributes
     RTVPFSRC        Retrieve PF source
     SNDCOMPMSG      Send completion message
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message
     SNDJLGMSG       Send job log message

Implementation
--------------

None, the tool is ready to use.

Objects used by the tool
------------------------

   Object        Type    Attribute      Src member    Src file
   ------        ----    ---------      ----------    ----------

   CRTDBFJRN     *CMD                   TAAJRNU       QATTCMD
   CRTDBFJRN2    *CMD                   TAAJRNU2      QATTCMD
   TAAJRNUC      *PGM       CLP         TAAJRNUC      QATTCL
   TAAJRNUC2     *PGM       CLP         TAAJRNUC2     QATTCL
   TAAJRNUR      *PGM       RPG         TAAJRNUR      QATTRPG
   TAAJRNUR11    *PGM       RPG         TAAJRNUR11    QATTRPG

Structure
---------

CRTDBFJRN     Cmd
   TAAJRNUC     CL Pgm
      TAAJRNUR    RPG Pgm
      TAAJRNUR11  RPG Pgm

CRTDBFJRN2    Cmd
   TAAJRNUC2    CL Pgm
      TAAJRNUR    RPG Pgm
					

Added to TAA Productivity tools November 15, 1999


Home Page Up to Top