TAA Tools
CHKSPELL2       CHECK SPELLING 2                       TAATXTE

The Check Spelling  2 tool provides  a method of checking  the spelling
of a string  of text (up to 2000 bytes).   The command interface may be
used,  but the CPP (TAATXTEC) be  called directly.  The command returns
variables and may only be run  from a CL program.  The QTWCHKSP  API is
used.  Unique  spelling dictionaries can be created  with the CRTSPADCT
command.   Special dictionaries are supplied  with the TAA Productivity
Tools.  See the discussion with the TAADCT TAA Tool.

To understand  the CHKSPELL2  interface, the  simplest  approach is  to
understand the command.

A typical  command to  check a string  of data that  is 100  bytes long
would be:

        DCL           &BADWRD *CHAR LEN(20)
        IF            (&BADWRD *NE '  ') DO /* Spelling error */

The  first word  in  error would  be returned  (if any)  in  the return
variable &BADWRD.  Note  that only a single  error is returned on  each
use of the command.

There are additional options on the command:

  **   An  optional  return  variable  BADWRDNBR   describes  the  word
       number  within the string  where the error  was found.   This is
       intended  to work  in conjunction  with the  STRAFTWRD parameter
       to cause  the next  use of the  command to  bypass the  previous
       word in error.

       For example, assume that the string of text to be checked is:

             The SPEEDYLAUNDRY is opn 24 hours

       When  the command  is run,  the  default for  STRAFTWRD is  zero
       which  causes the  spelling check to  begin with  the first word
       'The'.  The word 'SPEEDYLAUNDRY'  is not in a normal  dictionary
       so an error would  occur on the second word.   The command would
       end  with the  BADWRD return  value  of 'SPEEDYLAUNDRY'  and the
       BADWRDNBR of 2.

       The program using  CHKSPELL2 would probably  display the  BADWRD
       value and offer  the user a choice  of starting again at  word 1
       or starting  after the word  in error.   To start after  word 2,
       the  program  would move  the BADWRDNBR  value to  the STRAFTWRD
       value and run the command again.

       If  STRAFTWRD(2)  was  specified,  CHKSPELL2  would  ignore  any
       words  until the 3rd  word.   Another error  would occur  on the
       4th word  'opn'.  This time it is  a real spelling error.  After
       the user  corrected the  value, the  program  could begin  again
       after 2nd or 4th word depending on the setting of STRAFTWRD.

  **   An  optional parameter  SETLR  allows the  CHKSPELL2 program  to
       remain  open.  The default  is *YES which causes  the program to
       close after spell checking the string.   A value of *NO,  causes
       the program to  remain open after  spell checking the  string so
       that  the next time  the program  is called, the  performance is
       better.   A  value of *IMMED  causes the program  to end without
       spell checking the string.

  **   An   optional   parameter   DCTARA   determines   the   spelling
       dictionaries  to be used.   A  list of  dictionaries to  be used
       can  be created with  the CRTDCTARA tool in  the special library
       TAADCT.   CRTDCTARA creates  a data  area.   The EDTCONARR  tool
       can be used  to enter a list of  up to 8 dictionaries.   See the
       discussion with the CRTDCTARA tool.

       The default for DCTARA is *DFT which causes the following:

         --   If  no TAADCT  library exists,  the TAADFT  dictionary in
              TAATOOL is used.

         --   If TAADCT exists,  a data area  by the name  of the  user
              of the job  is searched for.   If it exists, it  is used.

         --   If a  user dictionary does not exist, a  data area by the
              name of SYSTEM is searched for in TAADCT.

         --   If  neither  a  user  data area  or  a  SYSTEM  data area
              exists in  TAADCT, the  TAADFT dictionary  in TAATOOL  is

Command parameters                                    *CMD

   DATA          The string  of data to be  checked.  Up  to 2000 bytes
                 may be used.

                 When  the  command is  used,  the length  can  be less
                 than  2000.   When  the  CPP  is  called  directly,  a
                 length of 2000 must be used.

   DATALEN       The  data length  to be  checked.   The  value can  be
                 less  than the  length of  the DATA  value.   The data
                 length must be a value between 5 and 2000.

   BADWRD        A required  return value  that  must be  specified  as
                 *CHAR LEN(20).   If no spelling errors are  found, the
                 value will  be blank.   If a spelling  error is found,
                 the error word will be in the return value.

   BADWRDNBR     An  optional return value  for the number  of the word
                 in  the  string that  is  in  error.    If  used,  the
                 parameter  must be declared  as *DEC  LEN(5 0).   This
                 parameter  is  designed  to  work  with  STRAFTWRD  to
                 allow  the  next  use   of  CHKSPELL  to  bypass   all
                 checking of previously checked words.

   STRAFTWRD     An optional  parameter to  cause the  use of  CHKSPELL
                 to   ignore  any   checking  until  after   the  value
                 entered.  See  the previous discussion  about how  the
                 value is intended to be used.

   SETLR         An  optional parameter  to  cause  the program  to  be
                 ended or  remain open at the end of  the command.  The
                 default  is  *YES  which  causes  the  program  to  be
                 opened and closed each time it is called.

                 *NO  causes   the  program   to   remain  open   after
                 performing spell checking.

                 *IMMED  causes the program  to end  without performing
                 any spell checking.

   DCTARA        An   optional  parameter   that   allows  a   list  of
                 dictionaries to  be specified  by naming  a data  area
                 in  library  TAADCT  that  contains  the  list.    The
                 default  is *DFT.   The list  of dictionaries  must be
                 entered according to  the CRTDCTARA TAA  Tool and  the
                 data area  containing the  dictionaries must exist  in
                 the  TAADCT library.    Up  to 8  dictionaries  may be
                 named in the data area.

                 If *DFT is specified, the following rules exist:

                 1)  If the library  TAADCT does not  exist, the TAADFT
                 dictionary in TAATOOL is used.

                 2) If the  TAADCT library exists,  a data area by  the
                 name  of  the user  of  the  job  is searched  for  in
                 TAADCT.   If  it does  not exist, a  data area  by the
                 name of SYSTEM is searched for in TAADCT.

                 3) If neither data  area exists the TAADFT  dictionary
                 in TAATOOL is used.

   DICT          The name  of a specific dictionary  to be used.   *DFT
                 is  the  default in  which case  the  DCTARA parameter
                 takes precedence.

                 A specific dictionary  name may be  used along with  a
                 library  qualifier.    If  a  specific  dictionary  is
                 named, DCTARA(*DFT) must be used.

Calling the CPP directly

The CPP  TAATXTEC may be  called directly from  a HLL program  to spell
check a string.  The full parameter list must be declared as:

             DATA           *CHAR   LEN(2000)
             DATALEN        *DEC    LEN(5 0)
             BADWRD         *CHAR   LEN(20)
             BADWRDNBR      *DEC    LEN(5 0)
             STRAFTWRD      *DEC    LEN(5 0)
             SETLR          *CHAR   LEN(6)
             DCTARA         *CHAR   LEN(10)
             DICT           *CHAR   LEN(10)
             DICTL          *CHAR   LEN(10)

See the previous discussion of the command parameters.


You must have the Dictionary product (DCT) on your system.

Because  the command  returns variables,  it can only  be used  in a CL


The following TAA Tools must be on your system:

     SNDESCMSG       Send escape message


None, the tool is ready to use.

To specify dictionaries  other than US in  QDCT, see the CRTDCTARA  TAA

To  create  unique  dictionaries,  see  the CRTSPADCT  command  of  the
Dictionary product.

Objects used by the tool

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

   CHKSPELL2     *CMD                   TAATXTE       QATTCMD
   TAATXTEC      *PGM       CLP         TAATXTEC      QATTCL
   TAATXTEC2     *PGM       CLP         TAATXTEC2     QATTCL
   TAATXTER      *PGM       RPG         TAATXTER      QATTRPG

Note that TAATXTER is the CPP and uses the subprogram TAATXTEC.

Added to TAA Productivity tools May 1, 1996

Home Page Up to Top