The Fix RPG End Operation Codes tool checks or updates RPG source
code for END statements to make them ENDIF, ENDDO, ENDSL, etc. The
command can run against a single member in the QRPGSRC file such as:
or against an entire source file named SOURCE:
FIXRPGEND MBR(*ALL) SRCFILE(SOURCE)
The source file may contain other types of source. Only the members
with a type of RPG, RPGLE, or RPGMOD are processed.
If a source statement already has an ENDxx operation code, it is not
An option exists to allow you to just check the source (not update
it). See the UPDSRC parameter. The default is to update the source
in which case the statements are changed in the source member. Only
the operation code and optionally the 'date changed' are updated.
The rest of the statement remains as it was. The CHGSRCDAT parameter
determines whether any statements that are changed will have the
current date or the existing date.
An option exists to print the statement numbers where an END
operation has been found and the new operation code that would be
used (if UPDSRC(*YES) is specified, this is the new value). See the
If MBR(*ALL) is specified, a spooled file is output describing the
You must have valid RPG source such as matching IF/END pairs. If not
an error will be signalled, but some source statements may already
have been updated. If you have just compiled the source
successfully, it is appropriate to use FIXRPGEND and take the default
of UPDSRC(*YES). If you have not compiled for some time or are using
MBR(*ALL), it makes sense to specify UPDSRC(*NO) first and ensure
that your source can be correctly processed.
Use of lower case in RPGLE
The operation codes are translated to upper case before checking so
that a value of 'ifle', 'IFLE, or 'iFLe' are all considered to be an
If the operation code used is all lower case such as 'ifle' or 'do',
the corresponding end statement (if changed) will be all lower case
such as 'endif' or 'enddo'.
If the operation code used begins with upper case such as 'Ifle' or
'Do', the corresponding end statement (if changed) will be 'EndIf' or
If the operation code used has other forms of mixed case such as
'iFle' or 'dO', the corresponding end statement (if changed) will be
all upper case 'ENDIF' or 'ENDDO'
Command parameters *CMD
MBR The source member name to check or update. The
special value *ALL may be entered to check/update
all members in the file. Only a member of type RPG,
RPGLE, or RPGMOD will be checked/updated.
SRCFILE The qualified file name of the source file. The
file name defaults to QRPGSRC. The library value
defaults to *LIBL.
UPDSRC A *YES/*NO value that determines if the source
member will be updated. The default is *YES which
causes the source statements with an operation code
of END to be updated with the appropriate value such
as ENDIF, ENDDO, etc.
*NO causes the member to be checked and a message is
sent describing whether there are any END operation
codes that could be changed. If MBR(*ALL) is
specified, the spooled file will contain the
information for each member.
PRTDTL A *YES/*NO value that determines if the detail
statements that contain an END operation code will
be printed along with what the new value could be or
has been changed to. The default is *NO.
If *YES is specified, only the sequence number and
the existing operation code is printed (not the full
CHGSRCDAT A *YES/*NO value that determines if the source
statement that is changed will have the current
date. *YES is the default meaning that any changed
statements will have the current date.
*NO may be specified to cause the existing source
statement dates to remain the same.
** Your RPG code must have valid RPG source (e.g. matching
IF/END pairs) or an error will occur. If you are updating the
source, some statements may already have been updated when a
** FIXRPGEND will handle up to 100 nested IF, DO etc. commands.
The following TAA Tools must be on your system:
ALCTMPMBR Allocate temporary member
EDTVAR Edit variable
HLRMVMSG HLL Remove message
RTVDAT Retrieve date
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
------ ---- --------- ---------- ----------
FIXRPGEND *CMD TAARPGI QATTCMD
TAARPGIC *PGM CLP TAARPGIC QATTCL
TAARPGIR *PGM RPG TAARPGIR QATTRPG