The Scan RPG Field 3 command finds all references to a specified
field name in a member, generic members, or all members in a source
file that match a list of Operation Codes. A special Op code value
exists to search for Operation Codes with Year 2000 considerations.
Only RPG source types (including RPGLE) are searched for. Derivative
fields are also considered.
A typical command would be:
SCNRPGFLD3 FLDNAME(DATE1) SRCMBR(ABC*) SRCFILE(QRPGSRC)
All calculation references to DATE1 would be found in the generic
member names beginning with ABC. The list of Op codes that have Year
2000 considerations such as IFLE, CABGT, WHGE, etc would be checked
for. Also included are CHAIN, KFLD, PARM, SETGT, and SETLL. Equal
and non-equal Op codes such as IFEQ and CABNE would be bypassed. If
the source is an RPG IV type, the corresponding RPG IV operation
codes would be searched for. Any statement would be flagged if it
matches one of the specified Op codes.
If the DATE1 data was used to change another field such as a MOVE
from DATE1 to YY, the YY field would also be searched for. The field
that was changed is termed a 'derived field'. If the YY field were
moved to field ZZ, the ZZ field would also be scanned for, etc.
A spooled file would be created with each statement listed and
flagged (*** in positions 2 - 4) where the specified Op code is used
with the named or derived fields. Any statements creating a derived
field are also listed.
If you are scanning for the field named BBB and an RPG statement
moves the data from field AAA to BBB, AAA is not considered to be a
derived field. Derived fields occur only when the data in the field
you named is used to change a result field such as with a MOVE, CAT,
or ADD operation. This excludes the use of index fields or modifiers
such as used on CAT operations.
If the field being scanned for is a sub field in an internal data
structure, any overlapping fields are also considered 'derived' and
will be scanned for as well as the data structure name. If the
internal data structure name is the result field of a scanned for
field, both the data structure name and all fields within the
internal data structure are considered 'derived'.
Fields within an externally described data structure are not
considered 'derived' if the name of the data structure is changed.
Overlapped fields within OPM Input specifications are considered as
If the specified source file contains source types other than RPG
types, they are bypassed. The processed source types are RPG, RPGLE,
RPG36, RPG38, RPT, SQLRPG, SQLRPGLE, SQLRPGMOD, and RPGMOD.
Less than perfect Year 2000 checking
Note that the *YEAR2000 default is not a perfect test of all year
2000 considerations. While the majority of typical situations will
be found, the following are examples that could be missed.
** A calculation that determines an age by subtracting the 2
digit birthyear from the 2 digit current year would produce a
derived field. However, unless the derived field was used by
a comparison Op code (or PARM, KFLD, etc.), the occurrence
would not be considered.
** You will generally scan for date fields in your data base. If
a date is passed as a parameter, you may not know to scan for
** Program described data files may have different names for the
date fields. You must scan for each name used.
** If data is moved to an externally described data structure, a
field within the structure would not be recognized as a
derived field. If the data structure contains many fields, it
is unlikely that this will cause a problem. However, if the
data structure is only a date field, the derived sub fields
would be missed.
Comparison with the SCNRPGFLD2 tool
The SCNRPGFLD2 tool will also scan for a field name and derived
fields. However, SCNRPGFLD2 lists every occurrence of a field being
scanned for and any derived fields.
SCNRPGFLD3 only lists statements where the scanned for field is being
used with one of the specified Operation codes and flags the
statements. SCNRPGFLD3 also lists the statements that create derived
Command parameters *CMD
FLDNAME The field name to be searched for. An exact
comparison must exist (no generic support).
If a field is used in an operation such as MOVE to
change a result field, the result field is known as
a 'derived field'. The derived field is also
searched for and any fields derived from the derived
Overlapping fields in a data structure are
considered derived fields. If the data structure
name is changed, all fields within the data
structure are considered derived fields.
SRCMBR The member to be searched. Either a specific
member, a generic member name, or the special value
*ALL may be specified. If a generic member name or
*ALL is entered, only RPG type source members
(including RPGLE) are searched.
SRCFILE The qualified file name of the source file. QRPGSRC
is the default. The library value defaults to
*LIBL. *CURLIB may also be used.
OPCODE The Operation Code to be checked for.
The default is *YEAR2000 which checks for comparison
Op codes involving GE, LE, GT, LE. This includes
IFxx, WHxx, and CABxx. It also includes COMP and
LOKUP Operations where a Hi or Lo indicator is
It excludes Operation Codes where an equal or
unequal test is being made such as IFEQ, CABNE, etc.
If RPG IV source exists, the corresponding RPG IV op
codes are checked for.
The *YEAR2000 default is not a perfect test of all
year 2000 considerations. However, it should find
the majority of typical situations.
You may specify your own list of Op Codes. Up to 40
Op codes may be specified.
Valid RPG source must exist.
Statements copied by /COPY are not considered.
Not all RPG IV syntactical uses are supported.
Also see previous comments.
The sub tool RTVRPGFLD has some restrictions.
The following TAA Tools must be on your system:
CHKGENERC Check generic
EDTVAR Edit variable
EXTLST2 Extract list 2
HLRMVMSG HLL Remove message
RTVDBFA Retrieve data base file attributes
RTVMBRLST2 Retrieve member list 2
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
SCNRPGFLD3 *CMD TAARPHE QATTCMD
TAARPHEC *PGM CLP TAARPHEC QATTCL
TAARPHEC2 *PGM CLP TAARPHEC2 QATTCL
TAARPHER *PGM RPG TAARPHER QATTRPG