TAA Tools
CHKNAMFLD       CHECK NAME FIELD                       TAADBKX

The Check Name Field command  allows you to check or update  a name and
address  field in  a  file for  names  such 'THomas  ThuMb'  or 'Thomas
thumb'  and  have them  changed to  'Thomas Thumb'.    The field  to be
checked is ensured  to have the first  letter of each word  capitalized
and the remaining letters to be lower case.

A list  of small words  such as 'and', 'or',  etc may be  left in lower
case.     A   list  of  proposed   changes  occurs   with  the  default
OPTION(*CHECK).  OPTION(*UPDATE) may be used to make the changes.

Only the English language is supported  in the supplied code.  See  the
later section on 'Non-English languages'.

See  also the  CHKNAMFLD2  tool which  allows  similar  checking via  a
command with a passed in value and a return value.

Because  business names  have a  lot  of acronyms  (eg 'ABC  Co.' which
would have a  proposed change  of 'Abc Co.'),  only the  OPTION(*CHECK)
function  may  be  effective in  pointing  out  names  that  should  be

A typical command would be:


By  default the CUST  field of the  first member  of the file  would be
checked  (no changes would occur).   Any values in  the CUST field that
did not follow the rules:

  **   First letter of  each word must  be capitalized.   A blank or  a
       single quote determines the word delimiter.

  **   All  other  letters  in  a   word  are  lower  case.    See  the
       exceptions discussed later for 'Mc' and 'Mac'.

  **   Exceptions  are made for  small words such as  'the', 'and', etc
       which are left  in lower case.   An exception  is also made  for
       the  first word  to allow  a name  such  as 'The  Best Inc.'  to
       appear with  a capitalized first letter even  though 'the' is in
       the small word list.

After reviewing the proposed changes, you  can update the data base  by
specifying OPTION(*UPDATE).

Names with embedded capitals

The technique used determines the  beginning of a word by a  blank or a
single quote.   Checking for a  single quote allows a  name like O'Neil
to be be properly handled.

However,  some names have  embedded capitals such  as 'VanHoeven.  This
would be proposed as 'Vanhoeven'.   If the name exists as  'Van Hoeven'
it would be properly checked.

An exception  is made for names that  begin with 'Mc' or  'Mac' such as
McKnight or  MacIntosh.  If the letters 'Mc'  or 'Mac' are found, it is
assumed that the  next character is correct  (regardless of the  case).
Note that the case must be 'Mc' or 'Mac' for this to occur.

Technique used

The  first letter  of a  word is  ensured to  be upper  case using  the

        a - i  (X'81' - X'89') are folded to A - I (X'C1' - X'C9')
        j - r  (X'91' - X'99') are folded to J - R (X'D1' - X'D9')
        s - z  (X'A2' - X'A9') are folded to S - Z (X'E2' - X'E9')

The  following letters  of a word  are ensured  to be lower  case using
the following:

        A - I  (X'C1' - X'C9') are folded to a - i (X'81' - X'89')
        J - R  (X'D1' - X'D9') are folded to j - r (X'91' - X'99')
        S - Z  (X'E2' - X'E9') are folded to s - z (X'A2' - X'A9')

Any other characters (such as digits) would be left as is.

Small words

The following small words will be kept in lower case:


unless they appear  at the  beginning of the  field such  as 'The  Best

The  data  for  the  small words  is  held  in  the  TAADBKXP  file  in
TAASECURE.  As  an *ALLOBJ user, you may add  or subtract words in this
file by entering:


The words are entered twice such as:

          The       the

The  capitalized  version  is the  way  the  word would  appear  if the
SMALLWORDS option  was not requested.   The lower  case version is  the
way the word will  be changed to.  You may enter up  to 100 words where
each word may be 7 characters or less.

Both  versions of each  word must be  the same length or  an error will
occur during CHKNAMFLD.

Non-English languages

The  TAADBKXR program  may  be  changed  to  allow  for  additional  or
different character transformations.  Use:

             CPYTAA2   TOOL(CHKNAMFLD)

This will copy  the source to QATTxxx  source files in TAATOOL.   Use a
source  editor for member  TAADBKXR in file  QATTRPG in TAATOOL.   Scan
for TRANSFORM and see  how the code converts  various characters.   The
ZONE  field should  be  set  to allow  the  zone  of the  character  to
transform to.   For example, the a-i hex  values of X'81'-X'89' use the
zone of the letter 'A' (X'C1') to transform the character.

When coding is complete, enter:


This will re-create the required objects.

The  TAADBKXP  file in  TAASECURE  holds the  small  words that  do not
follow the normal  rules.   See the previous  section on 'Small  words'
and change as required.

Security considerations

The user  of the command  must have *USE  authority to the file  to use
OPTION(*CHECK).  *CHANGE authority is required for OPTION(*CHANGE).

The  TAADBKXR2 program  adopts authority  to allow  access to  the file
TAADBKXP in TAASECURE.   No known security  exposures exist using  this

CHKNAMFLD 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  or
                 updated.     The  library  value  defaults  to  *LIBL.
                 *CURLIB may also be used.

   FIELD         The field to be  checked or updated.   This must be  a
                 *CHAR field of 50 bytes or less.

                 The default  is *PROMPT  which displays  a subfile  of
                 the   the   fields   in   the   file  and   the   text
                 descriptions.  One field may be selected.

                 A specific field name may be entered.

   MBR           The  member to be  processed.  *FIRST  is the default.
                 A specific member name  or *LAST may also  be entered.

   OPTION        The  processing option  to  be used.    *CHECK is  the
                 default  to  only  print  a  listing  of the  proposed

                 *UPDATE may be entered to  update the data as well  as
                 produce a listing of the changes that were made.

   SMALLWORDS    A *YES/*NO  option for the  special handling  of small
                 words such as 'and', 'or'.

                 *YES  is the default to  cause these words  to be left
                 in  lower  case   (the  first  letter   will  not   be
                 capitalized).   An  exception is  made  for the  first
                 letter  in a  name  to allow  for names  such  as 'The
                 Best Inc'.

                 *NO   may   be  specified   to  prevent   any  special
                 treatment of small words.

                 See the  previous documentation  on  what small  words
                 are provided  by default and  how to modify  the list.


  **   The record length cannot exceed 9999 bytes.

  **   The field to be checked must be *CHAR of 50 bytes or less.

  **   Variable length fields are not supported.

  **   Only  the characters for  the English language  are provided for
       in the supplied code.


The following TAA Tools must be on your system:

     EDTVAR          Edit variable
     HLRMVMSG        HLL Remove message
     PMTFLD          Prompt field
     RTVDBFA         Retrieve file attributes
     RTVFLDA         Retrieve field attributes
     RTVSYSVAL3      Retrieve system value 3
     SNDCOMPMSG      Send completion message
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message


None, the tool is ready to use.

Objects used by the tool

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

   CHKNAMFLD     *CMD                   TAADBKX       QATTCMD
   TAADBKXC      *PGM       CLP         TAADBKXC      QATTCL
   TAADBKXR      *PGM       RPG         TAADBKXR      QATTRPG
   TAADBKXR2     *PGM       RPG         TAADBKXR2     QATTRPG

The TAADBKXP file exists in  library TAASECURE to hold the small  words
that may be retained in lower case.

Added to TAA Productivity tools November 15, 2005

Home Page Up to Top