TAA Tools
SCNSRC       SCAN SOURCE                             TAASRCF

***** Note.   SCNSRC  provides a  similar function to  FNDSTRPDM.   The
output of SCNSRC differs and is generally preferable to FNDSTRPDM.

The  SCNSRC command  allows a  simple method  of scanning  source files
for  a matching character  string or strings.   For example, assume you
want to  know  all the  places  in your  QRPGSRC  file where  you  have
specified the  field ACCRCV.   The SCNSRC command  can be used  to scan
all  members of a source file (or  generic members) and print a listing
with the  member name,  statement number  and the  statement where  the
field has been used.

To scan the QRPGSRC  file for all use of the argument  ACCRCV you would
specify:

         SCNSRC    FILE(*RPG) ARGUMENT(ACCRCV)

The  command operates on all  members of a source  file, a specifically
named member  or generic  members.   It utilizes  the OVRDBF  MBR(*ALL)
value to process all members  and the RPG SCAN op code to  scan for the
specified argument.   The output  is spooled using  a file name  of the
file  that  was  scanned.    Each  spooled  file  contains  any  source
statements  where  the   argument  or  arguments  were   found,  member
identification and summary totals.

An option  exists to end the scan  on the first found  statement.  This
can  be helpful  when you  are attempting  to copy  source and  need to
know where the first  instance exists that you  have used an  argument.

An  output file  containing the  member identification  and the  source
statement  containing  the argument  may  be optionally  output  to the
SCNSRCP file.   The spooled  listing is  always output on  each use  of
the command.

SCNSRC is a faster  scan technique that using OPNQRYF  against multiple
members.    OPNQRYF  does  not  allow  OVRDBF MBR(*ALL)  and  has  more
overhead than a normal open of a member.

The  command operates  on source files  of up to  a length  of 240 (228
bytes of source,  6 bytes of  sequence number and 6  bytes for date  of
change).    To allow  for  a  fast  execution, the  processing  program
issues an  OVRDBF to allow for 200 records to  be read at a time.  This
is  useful  for  batch,  but  may  be  undesirable  in  an  interactive
environment.   You  may wish  to restrict  the command  to batch  usage
only.

Note  that the scan  function will only  be successful if  the matching
string is completely  within a  single source  record.   If the  source
language being  scanned (e.g.   CL)  supports a syntax  which allows  a
single  statement  to span  multiple  records, the  scan  will only  be
successful  when  the entire  matching  string is  contained  in single
record.

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

   FILE          The  source  file  name  and  library.    The  library
                 defaults  to  *LIBL.    To simplify  the  entering  of
                 system  supplied source  file names,  you may  use the
                 standard abbreviations  like *RPG,  *RPGLE, *CLP  etc.

   ARGUMENT      Up  to 20  bytes  to use  in  the scan  and  up to  20
                 arguments.   This is  the string that  will be scanned
                 for.  You  may need  to surround the  value in  quotes
                 and enter in upper  case depending on the value.   For
                 typical field  names (e.g.  ACCRCV), the  value may be
                 entered  in  lower  case  without  quotes.    Trailing
                 blanks will be trimmed off.

   MBR           The  member  name.    It  defaults  to  *ALL  for  all
                 members in  a file.   A specific  member may  be named
                 or  a  generic name  (e.g.    PAY*).   Scanning  for a
                 generic  name  is   similar  to   scanning  for   *ALL
                 members.   All statements in  the source file  will be
                 read,  but  only  the statements  that  belong  to the
                 generic member name will be scanned.

   TRANSLATE     A *YES/*NO option that defaults  to *NO.  *YES  causes
                 the source  statement to be  translated to  upper case
                 before scanning for the argument.

   ADDBLANKS     The  number  of  blanks  to  add  to the  end  of  the
                 argument before scanning.

                 0  is the default  meaning the length  of the data for
                 each argument determines what is scanned for.

                 A value in a range of 0 to 3 must be entered.

                 The intent  of this  parameter is to  provide for  the
                 situation such  as when you  want to scan for  the end
                 of  a name  or word  ending in 'red',  but you  do not
                 want words  such  as  'redeem'.    Using  ADDBLANKS(1)
                 finds any words  such as 'altered' which  are followed
                 by a blank.

   CHGDAT        The  date to compare individual  source statements to.
                 *NONE is  the default  meaning all  source  statements
                 are considered.

                 A date  may be  entered in  job format  to compare  to
                 the   individual   source   statements   change   date
                 (positions  7-12)  of  a  source  statement.    If the
                 source  statement   was  changed  on   or  after   the
                 specified CHGDAT,  it will be  considered for listing.
                 Specifying  a CHGDAT  value can  reduce the  number of
                 print lines that must be reviewed.

   SELCOL6       Whether to select  only certain  source records  based
                 on the  value of column 6  of the source  data portion
                 of  the  record.   The  default is  *ANY  meaning that
                 column  6  is  not  considered  and  the  entire  data
                 portion of the record is scanned.

                 This  option  is  designed  for   RPG/RPGLE  to  allow
                 selection of  the type of specification such  as I, D,
                 C,   etc.    For  example,   if  C  is  entered,  only
                 statements with  a C in  column 6  of the source  data
                 will  be scanned.   Note  that this  may  include some
                 array and table data.

                 A  value should only be entered  when you are limiting
                 the scan to  RPG/RPGLE source types.   The scan  which
                 occurs is not  sensitive to the source  type and would
                 probably  provide misleading information  if a non-RPG
                 type of source was scanned.

   FIRSTFOUND    A *YES/*NO option  that defaults  to *NO.   *NO  means
                 that all members  will be scanned and  all statements.

                 *YES  means that  the command  will  end on  the first
                 statement   that  matches  the  argument.    Only  the
                 matching statement  will be  printed.   The  PRTFOLSTM
                 option is ignored.

                 *YES may  not be  specified when the  OUTLIB parameter
                 is used.

   PRTFOLSTM     A number or *YES/*NO option that defaults to *NO.

                 *NO  causes only the statements where  a hit was found
                 to be listed.

                 *YES means  that if  a hit  is found  on a  statement,
                 the next  statement will be  printed whether it  has a
                 hit  or not.   A  number may be  entered to  cause the
                 next 1-9 statements  to be listed.   A value  of 1  or
                 *YES have the same meaning.

                 The purpose of the  option is for a situation  such as
                 when you  are scanning for a command  name and want to
                 determine  the  additional lines  of the  same command
                 or some  following commands.   If  you are  interested
                 in the  use of  a specific keyword  on a  command, use
                 the SCNCMDKWD command.

                 If  *YES or a  number is specified, it  does not cause
                 the  record  following  a  hit  to  be  added  to  the
                 outfile if one has been requested.

   SPCAFT        The number  of spaces 'print  after'.  The  default it
                 1.  2 or 3 may also be specified.

                 The  intent  of requesting  more than  a  single space
                 after is when  you want  to write on  the listing  and
                 need more white space.

   PRTMBRTXT     A *YES/*NO option  that determines if the  member text
                 is listed before any detail lines.

                 *NO is  the default to list only  the member name with
                 each statement.

                 *YES  means  the  member text  appears  once  for each
                 member where a  hit is found  and precedes any  detail
                 lines.

   NOTFOUND      A  *YES/*NO option that  defaults to  *NO.   *NO means
                 that  if   whether  arguments  are  found  or  not,  a
                 completion message  is sent  and a  spooled file  will
                 be created.

                 *YES  means  that  if  no  arguments  are  found,  the
                 escape  message TAA9897  will be  sent and  no spooled
                 file will exist.  The intent  of *YES is when you  are
                 scanning  for a  'not  equal'  condition and  want  to
                 bypass all the members that match the argument.

   OUTLIB        The  library  in   which  the  file  SCNSRCP  will  be
                 placed.   The  file will  contain one  record for each
                 detail print line.   The default  is *NONE meaning  no
                 outfile is  created.  *LIBL or *CURLIB  may be entered
                 if  the SCNSRCP exists.  If  the SCNSRCP file does not
                 exist, a library must be specified.

   OUTMBR        The member of  the SCNSRCP file  to be used.   If  the
                 member does  not exist, it is  added.  The  default is
                 SCNSRCP.

   REPLACE       A  *YES/*NO  value for  whether the  member  should be
                 cleared before writing records  into it.  The  default
                 is *YES.

   STSMSG        A *PRG/*YES/*NO  option  that determines  if a  status
                 message is sent during the scan.

                 *PRG will  cause a progress bar message  to be sent if
                 all members are being processed.

                 *YES  sends  a status  message as  follows: 1)  If all
                 members of  a  file are  scanned, one  status  message
                 for  the  file  is  sent  2) If  a  single  member  is
                 scanned,  a  status message  is sent  with  the member
                 name.

                 *NO may be  specified to  prevent any status  messages
                 from occurring.

   SPLOPT        A hidden  parameter that  determines whether  a single
                 spooled file  will be created on each  call to the RPG
                 processing  program.    *NORMAL  is  the  default   to
                 provide  one spooled  file.   In  the  case where  all
                 members  are scanned,  an  Override  command specifies
                 MBR(*ALL)  so there is  only a single  call to the RPG
                 program per file.

                 *DETAIL  may  be  specified  when  individual  members
                 within  a  source  file  should be  scanned,  but  the
                 output  is required in a single  spooled file.  SCNSRC
                 will be used multiple times per source file.

                 *CLOSE should be specified  when after using  *DETAIL,
                 the printer  file should be  closed (when  all members
                 from  the  same file  have  been  processed).   *CLOSE
                 causes the final totals to  be printed, but no  member
                 is scanned.

                 *HITONL  (hits only)  should  be specified  when  only
                 specific  members  are  to  be  searched (such  as  by
                 source  type)  and  a  spooled  file  should  only  be
                 output  when  a  member   is  found  to  contain   the
                 argument.   The  spooled  file is  not  opened if  'no
                 hits' exist.

   SPCNAME       The  special name that  prints at the top  of the page
                 for  the  case  where  SPLOPT(*DETAIL)  is  specified.
                 This allows a generic name to print at the top.

File format
-----------

The file name that is output is SCNSRCP.

The model file used is TAASRCFP with a format name of SCNSRCR.

To see the field names used:

       DSPFMT    TAASRCFP

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

The value to be scanned for cannot span a source record.

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

The following TAA Tools must be on your system:

      CHKGENERC    Check generic
      EDTVAR       Edit variable
      HLRMVMSG     HLL Remove message
      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
   ------        -----      ---------      ----------     -----------

   SCNSRC        *CMD                      TAASRCF        QATTCMD

   TAASRCFP      *FILE         PF          TAASRCFP       QATTDDS
   TAASRCFC      *PGM          CLP         TAASRCFC       QATTCL
   TAASRCFC2     *PGM          CLP         TAASRCFC2      QATTCL
   TAASRCFR      *PGM          RPG         TAASRCFR       QATTRPG
   TAASRCFR2     *PGM          RPG         TAASRCFR2      QATTRPG
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top