TAA Tools
SCNDTA          SCAN DATA                              TAADBIG

The Scan Data command  scans a character field or  all character fields
in  a data  base  file for  a  value which  may include  wildcards.   A
spooled  file is  created which  identifies each  record containing the
value, the  field name,  and the positions  within the  data where  the
value was  found.  Either character  data or a hex  value (X'xxxx') may
be scanned for.

A typical command would be:

             SCNDTA       SCNVALUE(ABC) FILE(xxx) SCNFLD(ADDR)
                            IDFLD(zzz)

A  spooled file would be created with  each record that contains ABC in
the ADDR field.   The IDFLD field name would  be used to help  identify
the record  containing the value.   If  multiple ABC values  existed in
the ADDR field, each position would be identified.

You could scan all character fields in the record by the command:

             SCNDTA       SCNVALUE(ABC) FILE(xxx) SCNFLD(*ALLCHAR)
                            IDFLD(zzz)

A  hex value  may also be  scanned for.   For  example, if you  want to
find all the instances of X'00' in a field, you would specify:

             SCNDTA       SCNVALUE(X'00') FILE(xxx) SCNFLD(ADDR)
                            IDFLD(zzz)

The defaults on the command allow you  to prompt for the field name  to
be scanned and  the IDFLD (up to 3  fields can be used to  identify the
records).

A  Translate Table  option  is available  to assist  in  converting the
data  base data before scanning.  This can  be useful if the data is in
lower case.

From 1 to 5  blank characters may be  scanned for by using  the special
values *BLANK1 - *BLANK5.

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

   SCNVALUE      The value  to be scanned for.   Up to 20  bytes may be
                 entered.

                 If  the data in  the data base  is in  lower case, you
                 may enter  the  specific  hex  value to  scan  for  or
                 specify the TRNTBL parameter.

                 A hex  value may be entered  by entering X'xxxx'.   If
                 you   enter   a   hex   value,   you  should   specify
                 PRTHEX(*YES) to allow the value  to be printed in  hex
                 in the  spooled file.   This  will help identify  what
                 type of  scan occurred.   If PRTHEX(*NO) is  used, the
                 scan value may not be readable.

                 For  example, if you specify  X'00' as the scan value,
                 the spooled file  will not  identify what you  scanned
                 for unless PRTHEX(*YES) was specified.

                 An  all blank value  (X'40') or  a trailing  blank may
                 not  be  scanned  for.    Because  the  scan value  is
                 trimmed before scanning, trailing  blanks in the  scan
                 value (such as X'C1D340') will be trimmed off.

                 The special  values *BLANK1 -  *BLANK5 may be  used to
                 scan for one to 5 blanks.

   FILE          The  qualified file  name of the  file to  be scanned.
                 The library  value defaults  to  *LIBL.   *CURLIB  may
                 also be used.

                 A  physical or  logical file  (single  format) may  be
                 used.

   MBR           The member  to be scanned.  The  default is *FIRST for
                 the first member of the file.

   SCNFLD        The  field  to  be  scanned.   If  a  single  field is
                 named, it  must be  a character field  with a  maximum
                 of 500  bytes.  The  entire field will be  scanned and
                 all  occurrences of  the SCNVALUE will  be identified.

                 The default  is *PROMPT  in which  case  a subfile  is
                 displayed  of  all  the  fields  in  the  file  and  a
                 selection may be made.

                 *ALLCHAR   may  be   specified   in  which   case  all
                 character fields  that are  500  bytes or  less  where
                 the field  length is equal  to or  less than the  scan
                 value length are scanned.

   IDFLD         A list  of up to  3 fields which will  be printed with
                 each  record where  the scan value  is found.   If you
                 have a unique key  to the file, the unique  key fields
                 should be specified to help identify the record.

                 The  default is  *PROMPT in  which case  a  subfile is
                 displayed  of  all  the  fields  in  the  file  and  a
                 selection may be made.

                 Only 15 positions  of the ID  field print.   Character
                 fields may  be any  length.   Packed or  zoned decimal
                 fields are also supported.

   TRNTBL        The  Translate  Table  to be  used.    The default  is
                 *NONE meaning  the SCNVALUE  must  match the  data  in
                 the field to be scanned.

                 If the  data in the  field to be  scanned is in  lower
                 case,  a translate table  can be specified  to convert
                 the data before scanning.

                 *STD  may be entered to fold a-z  to A-Z.  This is the
                 same function  performed  by the  QSYSTRNTBL table  in
                 QSYS.

                 A  specific translate  table and  library may  also be
                 entered.

   PRTHEX        Whether  to  print  the  scan  value  in  hex  in  the
                 spooled listing.    The  default is  *NO  meaning  the
                 value will be printed as character data.

                 If  you enter  a hex  value for  SCNVALUE, you  should
                 specify   PRTHEX(*YES)  to  allow  the   value  to  be
                 printed in  hex in  the spooled  file listing.    This
                 will help  identify what  type of  scan occurred.   If
                 PRTHEX(*NO)  is  used,  the  scan  value  may  not  be
                 readable.

   WILDCARD      A  *YES/*NO value  for whether wildcards  exist in the
                 SCANVALUE.

                 *NO is  the  default meaning  that the  characters  in
                 SCANVALUE  are searched  for  the exact  match in  the
                 SCNFLD specified.

                 *YES   may  be   specified   to  mean   that  wildcard
                 characters exist  in  the  SCANVALUE.   Both  a  fixed
                 wildcard  (default is  '%')  and  a floating  wildcard
                 (default is '*') are supported.

                 A  fixed  wildcard allows  any character  to  meet the
                 criteria such  as  a  SCANVALUE of  'A%C'  would  find
                 ABC, ADC, etc.

                 A floating  wildcard allows  any number of  characters
                 to  exist.  For  example, a  SCANVALUE of  'A*C' would
                 find 'AC', 'ABC', 'ABDC', or 'ABDEC'.

                 A  value  such as  'A%C*' would  find 'ABC',  ADC', or
                 any characters after the 'C' such as 'ABCXYZ'.

                 A  value  of 'A*C*'  would  find  'AC',  'ABC',  ABDC,
                 'ABDEC'   or  any   value  after   the  'C'   such  as
                 'ABDCXYZ'.

                 For  a   more  complete  discussion  of  the  wildcard
                 function see the CMPWLDCRD  tool.  The CHKWLDCRD2  and
                 CMPWLDCRD2 functions are used within SCNDTA.

   FIXWLDCRD     The  character  that  is  the  fixed  wildcard.    The
                 default is '%'.

   FLTWLDCRD     The  character  that is  the floating  wildcard.   The
                 default is '*'.

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

See the previous comments.

The record length of the file cannot exceed 9999.

The number of fields cannot exceed 998.

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

The following TAA Tools must be on your system:

     CMPWLDCRD       Compare wild card
     CVTHEX          Convert hex
     EDTVAR          Edit variable
     EXPVAL          Expand value
     EXTLST2         Extract list 2
     FILEFDBCK       File feedback
     HLRMVMSG        HLL Remove message
     PMTFLD          Prompt field
     RTVFLDARR       Retrieve field array
     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
   ------        ----    ---------      ----------    ----------

   SCNDTA        *CMD                   TAADBIG       QATTCMD
   TAADBIGC      *PGM       CLP         TAADBIGC      QATTCL
   TAADBIGR      *PGM       RPG         TAADBIGR      QATTRPG
					

Added to TAA Productivity tools June 1, 1997


Home Page Up to Top