TAA Tools
SCNDTAARA       SCAN DATA AREA                         TAAARAM

The Scan Data  Area command scans a data  area for a string.   This can
be helpful  if data areas  are used to  store user values  and a search
technique  is needed.  A value is passed  back for where the string was
found.  The command may only be used in a CL program.

A typical command would be:

            DCL           &RX *DEC LEN(5 0)
             .
            SCNDTAARA     DTAARA(xxx) SCNVAL(ABC) STRPOS(1) RTNPOS(&RX)
            IF            (&RX *GT 0) DO /* Found it */
             .
             .            /* Your processing for the found value */
             .
            ENDDO         /* Found it */

The scan  starts at  position 1 looking  for the  value ABC.   The  &RX
variable will contain  the first position where it is found.   If it is
not found, &RX = 0.

SCNDTAARA escape messages you can monitor for
---------------------------------------------

      TAA9894    The Scan value is *GT than the data area length
      TAA9895    The Start position is *GT than the data area length

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

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

   DTAARA        The  qualified name  of the  data area to  be scanned.
                 The library  value  defaults to  *LIBL.   *CURLIB  may
                 also be used.

   SCNVAL        The  value  to scan  for.    Up  to  20 bytes  may  be
                 entered.   The  last  non-blank determines  the length
                 of the scan.

   STRPOS        The start position.   The default  is 1.   It must  be
                 in a range of 1 to 2000.

   TRANSLATE     A *YES/*NO  value for  whether to  translate the  data
                 in the data area to upper case before scanning.

                 *NO is the default to not translate.

                 *YES may  be specified to translate the  data to upper
                 case.

   RTNPOS        The  return position  where the  value was  found.  If
                 the scan  value  was not  found,  the RTNPOS  variable
                 will  be 0.   The  variable must  be declared  as *DEC
                 LEN(5 0).

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

Because  the command returns  a variable, it  may only be used  in a CL
program.

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

The following TAA Tools must be on your system:

     CHKOBJ3         Check object 3
     EDTVAR          Edit variable
     RTVVALA         Retrieve value attributes
     SNDESCMSG       Send escape message

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

None, the tool is ready to use.

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

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

   SCNDTAARA     *CMD                   TAAARAM       QATTCMD
   TAAARAMC      *PGM       CLP         TAAARAMC      QATTCL
					

Added to TAA Productivity tools February 1, 2001


Home Page Up to Top