TAA Tools
DMOVALKEY       DEMO VALIDATE KEY                      TAAKEYA

The Demo Validate  Key tool is designed  to assist in cases  where keys
are to  be added to  a file, but  potential miskeying errors  may allow
the  addition  of  an  existing  record  (or  the  existing  record was
miskeyed).   The Validate  Key program  returns an  array of  potential
alternate keys that can be checked against a data base.

Assume the  operator is  told to  add an employee  record and  a Social
Security  Number  is provided  as  the key.    If the  key  is provided
incorrectly or the operator incorrectly  keys the value, the data  base
can become contaminated with invalid or duplicate records.

The Demo  Validate Key command  provides a demonstration  function that
generates  potential miskeying values.   By default, a  key of '123456'
and a length  of 6 is  passed to the program  that generates  alternate
keys.  The DMOVALKEY command prints the alternate keys.

To try the various options provided, prompt for:

             DMOVALKEY

and vary the options.

Use DSPSPLF to  see the generated  list of potential  miskeying values.

The  key  value  entered  (KZVALU)  will  not  appear in  the  list  of
alternate keys.

Creating a program for your own data base
-----------------------------------------

A  typical use of the function is to  create a program that may be used
periodically to check for potential duplicates.

Sample code is provided in the TAAKEYAR2 RPG source member to:

         - Read a data base file
         - Use the key as input to generate potential miskey values
         - Chain to the file using the potential miskey values
         - Output a spooled file with the potential conflicts

You  should  be   able  to  copy  the   code  and  make  the   required
modifications in  a few  minutes and  try the result  on one  your data
files.

Use the following steps to begin your own specific version:

  **   Copy  the  source  from  the TAA  Tool  Archive  to  your source
       member:

            CPYTAA     TAAARCMBR(TAAKEYAR2)
                         TOMBR(xxx)
                         TOSRCFILE(yyy/zzz)

  **   Edit the  source  and  read  the instructions  included  in  the
       source to modify the code for your specific use.

       Both  'Required' and  'Optional' type  temporary comments  exist
       for  your review.   For example, you  are required to  change to
       your file and field names.   You may add optional function  such
       as comparing  on a  field for  'State' to reduce  the amount  of
       spooled output that must be reviewed.

  **   When the  temporary comments are  no longer needed,  remove them
       with the command:

             RMVSRCCMT   MBR(xxx) SRCFILE(yyy/zzz)

The  same basic  approach may  also be  used for  any other use  of the
program that generates the potential miskey values.

Options with the TAAKEYAR program
---------------------------------

The  TAAKEYAR  program  generates  the  list  of   potential  miskeying
values.  The program is passed 4 parameters:

  **   An  externally described  data  structure including  the key  to
       generate  potential   miskeying  values  from,  the  setting  of
       various  options,  and  the  return  number  of  array  elements
       generated.

  **   The  first  segment  of  the returned  array  of  values.    The
       potential  size of  the array  is large so  the array  is passed
       back as  3  segments.    Standard code  in  the  sample  program
       places each segment into the proper place in the array.

  **   The second segment.

  **   The third segment.

The following fields must  contain a value in the  Externally Described
data structure to be passed.

   KZVALU        The key  to be passed  which will be  used to generate
                 potential miskeying values.

   KZLEN         The  maximum length  of the key.   It must  be a value
                 between  1  and  15.    Note  that  in  the  DMOVALKEY
                 function, the key is limited to 14 bytes.

Regardless  of the  options selected,  the program  will  always return
generated  miskeying  values where  a two  character  transposition may
have occurred.   For example, if  the key is  123456, the operator  may
have entered it as 213456, 132456, ...  123465.

The following  are options  that may  be specified  and determine  what
keys will be generated.

   KZFIXL        A  *YES/*NO  value  for  whether  your  key  is  fixed
                 length.  For example, a ZIP  code must be 5 digits  in
                 length.   *NO  is  the  default.   A  blank  value  is
                 assumed  to be  *NO.  If  *NO is  used, values  with a
                 dropped  character will be generated.   For example, a
                 key  of  123456  will  generate   potential  miskeying
                 values of 23456, 13456, ...  12345.

   KZNUM         A  *YES/*NO  value  for  whether  your  key  has  only
                 digits.    For example,  a  ZIP code  must  be numeric
                 only.  *NO is the  default.  A blank value is  assumed
                 to be *NO.

                 Specifying  a  *YES value  prevents  other  parameters
                 such as KZCHGU and KZCHGL from being *YES.

   KZCHGD        A  *YES/*NO  value  for  whether  the  program  should
                 generate   potential   values   where   one   of   the
                 characters will  vary with  a digit  of 0-9.   *NO  is
                 the default  and will not generate  any alternate keys
                 where   the  key  value   characters  are  changed  to
                 digits.  A blank value is assumed to be *NO.

                 If  *YES   is  specified,   alternate  keys  will   be
                 generated with  0-9 replacing any  character (the same
                 character  is  not generated).   For  example,  if the
                 key is 123456, the first  digit could be mis-keyed  as
                 0,  2  -  9.    The second  digit  could  be  also  be
                 miskeyed as 0, 1, or 3 - 9, etc.

   KZCHGU        A  *YES/*NO  value  for  whether  the  program  should
                 generate   potential   values   where   one   of   the
                 characters will vary  with a upper  case of A-Z.   *NO
                 is  the default  and will  not generate  any alternate
                 keys  where the  key value  characters are  changed to
                 upper case.  A blank  value is assumed to be *NO.   If
                 KZNUM(*YES) is specified, *NO must be used.

                 If   *YES  is  specified,   alternate  keys   will  be
                 generated   with  upper  case  letters  replacing  any
                 existing values  (the  same upper  case  character  is
                 not generated).   For example,  if the key  is 123456,
                 the  first digit  could be  mis-keyed as A  - Z.   The
                 second digit could  also be  miskeyed as A  - Z,  etc.
                 A  *YES,  will generate  several  potential  miskeying
                 values.

   KZCHGL        A  *YES/*NO  value  for  whether  the  program  should
                 generate   potential   values   where   one   of   the
                 characters will vary  with a lower  case of a-z.   *NO
                 is  the default  and will  not generate  any alternate
                 keys  where the  key value  characters are  changed to
                 lower case.  A blank value  is assumed to be *NO.   If
                 KZNUM(*YES) is specified, *NO must be used.

                 If  *YES   is  specified,   alternate  keys   will  be
                 generated  with   lower  case  letters  replacing  any
                 existing values  (the  same lower  case  character  is
                 not generated).   For example,  if the key  is 123456,
                 the  first digit  could be mis-keyed  as a  - z.   The
                 second  digit could  also be miskeyed  as a  - z, etc.
                 A  *YES, will  generate  several  potential  miskeying
                 values.

   KZDBL         A  *YES/*NO  value  for  whether  the  program  should
                 generate  potential  values  where  each character  is
                 doubled.   *NO  is the  default  meaning none  of  the
                 characters are doubled.   A blank value  is assumed to
                 be  *NO.   If KZFIXL(*YES) is  specified, *NO  must be
                 used.

                 *YES may  be  specified  to cause  a  doubling.    For
                 example,  if the  key  is  123456,  the key  could  be
                 entered  as 1123456, 1223456  ...   1234566.   A *YES,
                 will generate several potential miskeying values.

DMOVALKEY parameters                                  *CMD
--------------------

   KZVALU        The  value which  will be  used to  generate alternate
                 keys.  The value cannot be blank.

   KZLEN         The maximum length  of the KZVALU  field.  It must  be
                 in  a  range  of 1  -  14.    Note that  the  TAAKEYAR
                 program supports up to 15 characters.

   KZFIXL        A  *YES/*NO parameter for  whether the  field is fixed
                 length.  *NO is the  default meaning the KZVALU  value
                 may  be altered  in  length  for the  generated  keys.
                 This   includes  dropping   a  character   and  allows
                 KZDBL(*YES).

   KZNUM         A  *YES/*NO  parameter  for   whether  the  field   is
                 numeric only.   *NO is  the default meaning  the value
                 may contain any character.

                 *YES  may  be entered  if  the key  will  only contain
                 digits.    Entering  *YES prevents  a  *YES  value for
                 KZCHGU and KZCHGL.

   KZCHGD        A *YES/*NO  parameter for  whether  to generate  digit
                 alternatives  for  each  of  the  characters  entered.
                 *NO  is  the default  meaning  substitute  digits will
                 not be used to generate the alternate values.

                 *YES may  be  entered  if the  alternate  keys  should
                 include  substitute   digit  values.     For  example,
                 123456  becomes 023456,  223456, ...   923456, 103456,
                 etc.

   KZCHGU        A *YES/*NO  parameter for  whether to  generate  upper
                 case   alternatives  for   each   of  the   characters
                 entered.    *NO  is  the  default  meaning  substitute
                 upper  case characters  will not  be used  to generate
                 the alternate  values.   *YES  may be  entered if  the
                 alternate  keys should  include substitute  upper case
                 values.   For example, 123456  becomes A23456, B23456,
                 ...  Z23456, 1A3456, etc.

   KZCHGL        A *YES/*NO  parameter for  whether to  generate  lower
                 case   alternatives  for   each   of  the   characters
                 entered.    *NO  is  the  default  meaning  substitute
                 lower case  characters will  not be  used to  generate
                 the alternate values.

                 *YES  may be  entered  if  the alternate  keys  should
                 include  substitute lower case  values.   For example,
                 123456  becomes a23456,  b23456, ...   z23456, 1a3456,
                 etc.

   KZDBL         A *YES/*NO  parameter for whether  to generate  double
                 characters.   *NO  is  the default  meaning no  double
                 characters are generated.

                 *YES  may  be  entered if  the  alternate  keys should
                 include doubling  of  the characters.    For  example,
                 123456 becomes 1123456, 1223456, ...  1234566.

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

None.

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

The following TAA Tools must be on your system:

     EDTVAR          Edit variable
     FILEFDBCK       File feedback
     RTVVALA         Retrieve variable value attributes
     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
   ------        ----    ---------      ----------    ----------

   DMOVALKEY     *CMD                   TAAKEYA3      QATTRPG
   TAAKEYAC3     *PGM       CLP         TAAKEYAC3     QATTCL
   TAAKEYAR      *PGM       RPG         TAAKEYAR      QATTRPG
                                        TAAKEYAR2     QATTRPG
   TAAKEYAR3     *PGM       RPG         TAAKEYAR3     QATTRPG
   TAAKEYAP      *FILE      PF          TAAKEYAP      QATTRPG

TAAKEYAP is the Externally Described Data Structure.

Structure
---------

DMOVALKEY  Cmd
  TAAKEYAC3  CL
    TAAKEYAR3  RPG

TAAKEYAR is the program that generates the alternate keys.

TAAKEYAR2  is the  sample  code to  be copied  for  using the  TAAKEYAR
program.
					

Added to TAA Productivity tools August 1, 1998


Home Page Up to Top