TAA Tools
CHKDUPLST       CHECK FOR DUPLICATES IN A LIST         TAACLQY

The Check  for Duplicates in  a List command  is used to  check command
parameters  that are  simple lists  to ensure  that  each entry  in the
list  is unique.  Only the first  duplicate found is described with the
TAA9896 escape message.

Only simple lists  in Command Definition  are supported (ELEM  keywords
are used to create a complex lists or 'lists of lists'.)

Assume you have the following Command Definition Source:

             PARM       KWD(OMITLIBS) TYPE(*NAME) LEN(10) +
                          EXPR(*YES) MAX(40) SNGVAL(*NONE) +
                          DFT(*NONE) +
                          PROMPT('Libraries to omit')

Assume a CL program  is the CPP for the command and  you want to signal
an  error  if the  user has  entered the  same  library name  more than
once.  You would specify:

             DCL        &OMITLIBS *CHAR LEN(402) /* (10 * 40) + 2 */
              .
             CHKDUPLST  LIST(&OMITLIBS) ELMLEN(10)
             MONMSG     MSGID(TAA9896) EXEC(DO) /* Dup found */
              .
             ENDDO      /* Dup found */

The list is  passed to  CHKDUPLST as  it is passed  to the  CPP.   This
means the  first two  bytes contain  a binary  count of  the number  of
entries  in the  list followed by  the entries  (in this case  10 bytes
each for a DCL length of 402).

CHKDUPLST walks thru the list multiple times to ensure uniqueness.

You may  optionally add  either  or both  of  the PARMNAME  or  CMDNAME
parameters to  make a better  error message.   This would be  useful if
you  are going to  resend the  escape message  with a command  like the
TAA Tool RSNLSTMSG.

CHKDUPLST  escape messages you can monitor for
---------------------------------------------

      TAA9896    Duplicate in the list

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

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

   LIST          The  list as passed from  command definition.  It must
                 include the  two byte  binary count  at the  beginning
                 of the  list for  how many entries  exist.   A maximum
                 of  6000 bytes  may be  specified.   Your list  may be
                 less.

   ELMLEN        The element length.  This  is the length as  specified
                 in the LEN  parameter of the command.   The value must
                 be between 1 and 100.

   PARMNAME      The name  of the parameter that  the list is specified
                 for.  The default is  *NONE which means the  parameter
                 name will  not  be used  in the  escape message  text.
                 If you  are going to  provide your own  error message,
                 use *NONE.

                 Entering  a  name provides  better  error text.   Both
                 PARMNAME and CMDNAME may be specified.

   CMDNAME       The name  of the command  that the  list is  specified
                 for.   The default  is *NONE  which means  the command
                 name  will not  be  used in  the escape  message text.
                 If you are  going to provide  your own error  message,
                 use *NONE.

                 Entering  a name  provides  better error  text.   Both
                 PARMNAME and CMDNAME may be specified.

   DUPDTAARA     A  *YES/*NO value  for whether to  create a  data area
                 in QTEMP  for  the  duplicate entries.    *NO  is  the
                 default meaning no data area is created.

                 *YES  may be  specified to  cause  the TAADUPLST  data
                 area  to  be  created  in  QTEMP  (or  updated  if  it
                 already  exists).  The  data area is  defined as *CHAR
                 LEN(200) with  the  first duplicate  in positions  1-5
                 and  the  second in  6-10.    Only  the first  set  of
                 duplicates  is provided.   The value  of the duplicate
                 is in positions 101-200.

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

Only simple lists are supported.

The list  must  be passed  in  the same  format  as received  from  the
command.

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

The following TAA Tools must be on your system:

     EDTVAR          Edit variable
     SNDESCMSG       Send escape message

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

None, the tool is ready to use.

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

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

   CHKDUPLST     *CMD                   TAACLQY       QATTCMD
   TAACLQYC      *PGM       CLP         TAACLQYC      QATTCL
					

Added to TAA Productivity tools February 28, 2000


Home Page Up to Top