TAA Tools
SCNUPDSRC       SCAN AND UPDATE SOURCE                 TAASRDR

The Scan  and Update  Source command  allows a  single member,  generic
members, or  all members in a  source file to be scanned  for the value
of  a single statement  and replaced by  a single statement.   The scan
and replace values  must exist  in a separate  source member which  has
only two statements.   The entire statement is compared  for a match (a
scan does not occur).  A wildcard character may be specified.

Assume  you want to  replace the following  DCL which exists  in one or
more source members:

             DCL           &NAME *CHAR LEN(20) VALUE('Jones Co.')

      with

             DCL           &NAME *CHAR LEN(20) VALUE('Jones and Co.')

You would create a unique source  file (or use a separate source  file)
with  a member  containing two  statements.   The file  and member  are
termed  'models'.   Assume  the  names  are MDLFILE  and  MDLMBR.   The
MDLMBR member would contain the following two statements:

             DCL           &NAME *CHAR LEN(20) VALUE('Jones Co.')
             DCL           &NAME *CHAR LEN(20) VALUE('Jones and Co.')

The scan value must be  the first statement in  the model member.   The
replace value must be  the second statement in the model  member.  Only
two statements may exist in the model member.

You would then issue the command:

             SCNUPDSRC     MDLSRCFILE(MDLFILE) MDLMBR(MDLMBR)
                             SCNSRCFILE(xxxxx) SCNMBR(*ALL)

All  statements in  all  members in  the SCNSRCFILE  would  be scanned.
Each  statement would  be compared against  the first  statement in the
model member.  If a  match is found, the second statement in  the model
member would be used to replace the matched statement.

A  spooled  file  is   created  describing  the  statements  that  have
changed.

Note  that unless a  wildcard character is  specified, there  must be a
perfect match with the  model statement.  The  entire statement in  the
model member is  compared against each statement in the  source file to
be scanned.  The individual statements are not scanned.

Only  physical source files may  be specified.  The  records lengths of
the model file and the  source file to be  scanned must match.   Source
files up to 240 bytes in length may be used.

Any statements that are  changed retain the same sequence  number.  The
source change date is changed to the current date.

Wild card character
-------------------

You may  specify a wild  card character to  allow a comparison  that is
less  than a  full match.   The  default is  *NONE meaning there  is no
wildcard character.

For example, if you have an RPG statement such as:

     C                     MOVE 'ABC'     NAME3   3        Name value

and you need to  change ABC to DEF, you  probably do not care what  the
comment is  on the  right hand side  of the Calc  spec and you  may not
care  whether the  field is  defined (by  the 3 in  position 51).   You
could  enter  a  wild  card  character  such  as  @  in  place  of  the
characters that  you do  not care  about.  Your  two statements  in the
model member would look like:

     C                     MOVE 'ABC'     NAME3   @        @@@@@@@@@@@@
     C                     MOVE 'DEF'     NAME3   3        Name value

When  the  SCNUPDSRC  command is  run,  you  must specify  WILDCARD(@).
When the command runs, each statement  in your source file is moved  to
a work  area and changed  to include  @ values wherever  a @ exists  in
the the first  model statement.  The statement is  then compared.  If a
match is found, your replacement value is used.

Note  that  the  replacement  value  always  completely  replaces  your
source statement.   For  example,  if you  want to  retain the  current
comment and replace  only the code portion of  the statement, SCNUPDSRC
cannot be used.

If  you specify  a WILDCARD value  (other than  blank), one  or more of
the same  character must exist  in the  first statement  in your  model
member.

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

   MDLSRCFILE    The  qualified name  of the  model source  file.   The
                 library  value defaults  to *LIBL.   *CURLIB  may also
                 be used.

                 If the SCNMBR is *ALL or  a generic name, the name  of
                 the  model  file  must differ  from  the  file  to  be
                 scanned.

   MDLMBR        The  member  containing the  two  required statements.
                 The  first statement contains the  value to be scanned
                 for.   The second statement  contains the  replacement
                 value.

                 Only two statements may exist in the member.

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

   SCNMBR        The member name,  generic name,  or the special  value
                 *ALL  to  determine  the   member  or  members  to  be
                 scanned.

   WILDCARD      The  wild  card character  to  be used.    *NONE means
                 that  no  wild  card  character  will  exist  and  the
                 statement  must  be  a  perfect  match  before  it  is
                 replaced.   The wild  card character specified  on the
                 command  must also  be specified in  the 1st statement
                 in the model member.

                 See the  previous example  for  use of  the wild  card
                 character.

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

Each statement  is scanned.  Unless  a wild card character  is used, an
exact  match of the  scan value must  be found in order  to replace the
statement with the  replacement value  (a scan of  the statements  does
not occur).

Only source physical files may be used with SCNUPDSRC.

The  records lengths  of  the model  file  and the  source  file to  be
scanned must match.

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

The following TAA Tools must be on your system:

     CHKGENERC       Check generic
     CHKOBJ3         Check object 3
     EDTVAR          Edit variable
     HLRMVMSG        HLL Remove message
     RTVDBFA         Retrieve data base file attributes
     RTVMBRLST       Retrieve member list
     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
   ------        ----    ---------      ----------    ----------

   SCNUPDSRC     *CMD                   TAASRDR       QATTCMD
   TAASRDRC      *PGM       CLP         TAASRDRC      QATTCL
   TAASRDRR      *PGM       RPG         TAASRDRR      QATTRPG
					

Added to TAA Productivity tools July 1, 1998


Home Page Up to Top