Scan & Replace Data in Source (SCANRPL)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Scan & Replace Data in Source (SCANRPL) command scans one or all source file members in a source file and replaces a search pattern with the specified replacement text. Any source file member may be scanned and replaced using this command.

Restrictions:

Top

Parameters

Keyword Description Choices Notes
PATTERN Search pattern Character value Required, Positional 1
NEWVALUE Replacement string Character value Required, Positional 2
SRCFILE Source file Qualified object name Optional, Positional 3
Qualifier 1: Source file Name, QRPGLESRC
Qualifier 2: Library Name, *CURLIB, *LIBL
SRCMBR Source Member to scan Name, *ALL, *FIRST Optional, Positional 4
CASE Match case *MATCH, *IGNORE Optional, Positional 5
Top

Search pattern (PATTERN)

Specifies the search pattern used to scan the input source file record.

This is a required parameter.

character-value
Specify the search pattern. This parameter is case-sensitive unless CASE(*IGNORE) is specified.
Top

Replacement string (NEWVALUE)

Specifies the text that is inserted into the source record in place of the text specified on the search pattern parameter.

This is a required parameter.

character-value
Specify the replacement text. This parameter is case sensitive.
Top

Source file (SRCFILE)

Specifies source file that contains the source member to be scanned.

Qualifier 1: Source file

QRPGLESRC
RPG IV source file QRPGLESRC is used as the file name.
name
Specify the name of source file that contains the members to be scanned.

Qualifier 2: Library

*CURLIB
The current library contains the source file.
*LIBL
The library list is searched for the source file.
name
Specify the name of the library containing the source file.
Top

Source Member to scan (SRCMBR)

Specifies the source member that is searched.

*ALL
All source members in the source file specified on the SRCFILE parameter are searched scanned (and replaced where appropriate).
*FIRST
The first source member in the source file is searched.
name
Specify the name of specific source member to search.
Top

Match case (CASE)

Specifies whether upper/lower letter case differences are ignored.

*MATCH
Exact upper/lower letter case is used for the search.
*IGNORE
Upper/lower letter case is ignored for the search.
Top

Examples for SCANRPL

Example 1: Simple Command Example

SCANRPL PATTERN('xtools/qcpysrc,')
        NEWVALUE('cozTools/qcpysrc,')
          SRCFILE(QRPGLESRC) SRCMBR(*ALL) CASE(*IGNORE)

This command scans all source members in QRPGLESRC for the pattern 'xtools/qcpysrc' while ignoring upper/lower case variations. It then replaces each occurrance of that search pattern with 'cozTools/qcpysrc,'. The 'cozTools/qcpysrc,' replacement text is embedded with the same upper/lower case pattern as the users has specified on the command.

Top

Error messages

Unknown
Top