TAA Tools
DLTDUPRCD       DELETE DUPLICATE RECORDS               TAADBKM

The Delete  Duplicate Records  command deletes  duplicate records in  a
named  file based  on  a series  of  key fields.   By  default,  only a
listing  is  output  with  what  would  occur  if  ACTION(*DELETE)  was
specified.  When  *DELETE is specified,  the first duplicate record  of
a group is retained and the others are deleted.

You must have all rights to the file to use DLTDUPRCD.

An  exclusive lock  (*EXCL) is  requested  on the  member when  running
DLTDUPRCD with ACTION(*DELETE).

The named  file is sorted to a temporary file  in QTEMP.  If *DELETE is
requested, the  duplicates are  deleted from  the  temporary file,  and
then  the  temporary file  is  copied  back  to  the named  file  using
MBROPT(*REPLACE).

A typical command would be:

             DLTDUPRCD    FILE(xxx) FIELD(FIELDA) PRTFLD(FIELDB)

Because  the default of  ACTION(*CHECK) was  used, no records  would be
deleted.  A listing  would be output of  any duplicates found based  on
FIELDA.  The  value of FIELDA would be  listed along with the  value of
FIELDB which is used to help identify the records.

If ACTION(*DELETE)  had been specified, all but  the first duplicate of
each  group would be  deleted.  The  same listing would  be output with
an indication of what records were deleted.

Use with RTVDLTRCD TAA Tool
---------------------------

Because  of the  technique  used  by  DLTDUPRCD, the  records  are  not
deleted in  the named file.   Instead, the  records are deleted  from a
sorted  copy and  then  the remaining  records are  copied back  to the
named file using MBROPT(*REPLACE).

Consequently, there will not  be any deleted records  in the file  upon
completion and RTVDLTRCD cannot be used.

For the best  protection, you should make  a backup of the  file before
using DLTDUPRCD.

DLTDUPRCD  escape messages you can monitor for
----------------------------------------------

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

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

   FILE          The  qualified  name of  the  file to  be  checked for
                 duplicate values.    The  library  value  defaults  to
                 *LIBL.  *CURLIB may also be used.

   FIELD         Up  to 6  field  names  to  be checked  for  duplicate
                 values.   The file is sorted using  the field names as
                 the  sort fields.   The field  values are concatenated
                 together before  checking for  duplicates.   Character
                 fields  must  be  50  characters or  less.    Variable
                 length  fields are supported.   Decimal fields must be
                 15 digits or less.

   PRTFLD        A list of up  to 3 print  fields that will be  printed
                 along with the  duplicate values to help  identify the
                 duplicates.   The  default is  *NONE meaning  only the
                 duplicate values will be listed.

                 Character fields  may  be  any length,  but  only  the
                 first 50  bytes are  listed.   Decimal fields must  be
                 15 digits or less.

   MBR           The  member  to  be  processed for  duplicate  values.
                 The  default  is  *FIRST  based  on  the  create date.
                 *LAST may be specified  to process the last  member in
                 the file based on create date.

   ACTION        The type  of action  to be performed.   *CHECK  is the
                 default  to output a listing  describing what would be
                 deleted.  No records are deleted.

                 *DELETE may be  specified to  delete duplicates.   The
                 first duplicate  of a  group is  retained.  The  other
                 duplicates are deleted.  A listing occurs.

   OUTPUT        How  to  output the  results.   *  is  the  default to
                 display the  spooled file  if the  command is  entered
                 interactively.  The  spooled file is deleted  after it
                 is displayed.

                 If  the  command  is entered  in  batch  or *PRINT  is
                 specified,  the spooled  file is  output and retained.

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

  **   For the fields  specified for the  FIELD parameter to  determine
       duplicates: a)  Character fields must be 50  characters or less.
       b) Decimal fields must be 15 digits or less.

  **   The record length must be 9999 bytes or less.

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

The following TAA Tools must be on your system:

     CHKOBJ3         Check object 3
     EDTVAR          Edit variable
     EDTVAR2         Edit variable 2
     EXTLST          Extract list
     EXTLST2         Extract list 2
     HLRMVMSG        HLL Remove message
     RSNLSTMSG       Resend last message
     RTVDBFA         Retrieve data base file attributes
     RTVFLDA         Retrieve field attributes
     RTVFLDARR       Retrieve field array
     RTVSYSVAL3      Retrieve system value 3
     SNDCOMPMSG      Send completion message
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message
     SORTDBF         Sort data base file

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

None, the tool is ready to use.

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

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

   DLTDUPRCD     *CMD                   TAADBKM       QATTCMD
   TAADBKMC      *PGM       CLP         TAADBKMC      QATTCL
   TAADBKMR      *PGM       RPG         TAADBKMR      QATTRPG
					

Added to TAA Productivity tools June 15, 2004


Home Page Up to Top