The CHK400CMD command checks a source member to see if the commands
used contain only i5/OS supplied commands.
For example, to check the member PAYROLLC in QCLSRC, you would
The CHK400CMD could be used for the following functions:
** If you ship code to other systems using i5/OS and want to
ensure that the code only contains commands that can be
executed on the other systems.
** If you want to find the user written commands within your CL
** If you want to enforce a standard relative to what commands
can appear in CL programs.
** If you want to check for CALL commands in a CL program. See
the special command parameter.
Any commands not found will cause a listing to occur. The listing
will contain the source statement where a command was not found as
well as summary counts of the records and commands found. An option
exists to always print a summary listing. An option exists to
prevent any listing.
The command also supports an option to include include CALL and
If any errors are found, TAA9897 is sent as an escape message. An
option provides for 'checking only' in which case you could monitor
for TAA9897 to determine if any user commands (and/or CALL commands
exist). No printing occurs for this option.
The tool as shipped contains all of the i5/OS commands and a few
Program Product commands. If you want to include all of the commands
found in your version of QSYS, use CRTTAATOOL to recreate the
CHK400CMD tool on your system.
In addition, you can also tailor the list of valid commands by
entering the specific commands to be added or deleted by modifying
certain source members:
** A source member exists where you can add commands that you
want to be considered valid. The member is CHK400ADD in
TAATOOLSRC in the TAATOOL library. The commands can be
entered using SEU. The first 10 positions of each record
should be used. For example, if you wanted to add the EDTVAR
and MOVCHRDEC commands to the list of valid values you would
enter into CHK400ADD:
** A member exists where you can specify that existing o5/OS
commands be considered invalid. The member is CHK400RMV in
TAATOOLSRC in the TAATOOL library. For example, if you wanted
to flag any use of the PWRDWNSYS and CRTTBL commands you would
enter into CHK400RMV:
Any time you want to add or subtract commands from the list of valid
commands, the CHK400CMD must be re-created using CRTTAATOOL. Part of
the re-create process is to access all of the commands in QSYS
plus/minus those described in the specific source files.
The S/38 commands in QSYS38 are not included (if they exist in the
member being checked, they will be flagged).
The i5/OS commands are placed in an array within an RPG program. The
program uses a binary search technique to quickly determine if a
command is valid. This program should not be modified. You should
use the CRTTAATOOL command to re-create the CHK400CMD tool.
CHK400CMD is not a 100% match with CL syntax. The vast majority of
cases are processed correctly. See the later discussion of
exceptions. The program assumes that valid CL syntax is being used.
Special handling occurs for the commands IF, ELSE, MONMSG, and
SBMJOB. These commands may have an embedded command which is also
A standard source file (80 bytes of text) must be used.
If any exceptions exist, the command will complete and then send
TAA9897 as an escape message.
The listing describes:
** Number of statements read which is a count of the records in
** Number of exceptions found. For each exception there should
be one source statement printed.
** Number of total commands. This is the number of commands
sensed. Not every statement may contain a command because of
continuation lines or a statement may be only a comment. The
commands like IF, ELSE and MONMSG normally have an embedded
command which will also be counted.
** Number of 'primary commands'. This counts one per command
found, but does not count the embedded commands.
** Number of IF/ELSE/MONMSG/SBMJOB commands. The sum of this
number plus 'primary commands' may not equal 'Total commands'.
For example, a MONMSG command may not have an embedded
** Any IF or ELSE commands that do not have an embedded command
will be flagged. This may not be an exception in your code.
** Most cases where a command name is split over two statements
will be flagged. For example, the following will be flagged:
** The IF command is properly handled in most cases. One
exception is when an expression contains a test against a
literal which contains a parenthesis as well as other values.
For example, the following would be flagged:
IF (&A *EQ '((' ) CHGVAR &B &Z
IF (&A *EQ 'CMD(' ) CHGVAR &B &Z
The following would not be flagged
IF (&A *EQ '(' ) CHGVAR &B &Z
IF (&A *EQ ')' ) CHGVAR &B &Z
** The MONMSG command has an optional parameter CMPDTA followed
by the optional EXEC parameter which names a command to be
executed. The checking will only occur when the keyword EXEC
is specified. Thus if you have a MONMSG as follows, the
CHGVAR embedded command will not be checked:
MONMSG CPF0000 XXXXXX (CHGVAR &X &Y)
MONMSG CPF0000 XXXXXX CHGVAR &X &Y
The following CHGVARs will be checked:
MONMSG CPF0000 EXEC(CHGVAR &X &Y)
MONMSG MSGID(CPF0000) EXEC(CHGVAR &X &Y)
MONMSG MSGID(CPF0000) CMPDTA(XXX) EXEC(CHGVAR &X &Y)
MONMSG CPF0000 XXX EXEC(CHGVAR &X &Y)
** The SBMJOB command is checked for the use of the CMD
parameter. If it is not found, an error is noted.
Exception conditions noted in the listing
There are several exception conditions that may appear and are
described in the left most column of the listing.
** 'Not found'. This means the command is not in the array.
** 'GT 10 char'. The command name given exceeds 10 characters in
length. This exception condition is not acceptable in CL
** 'IF/ELSE err'. This is produced if the CHK400CMD program
cannot find an embedded command on an IF or ELSE command. For
example, this would be the case if the IF statement contained
a test for a parenthesis as previously described.
** 'CALL found'. This is produced if the CHK400CMD program is
requested to look for a CALL command.
** 'TFRCTL found'. This is produced if the CHK400CMD program is
requested to look for a TFRCTL command.
** 'No CMD PARM'. This is produced if the CHK400CMD program does
not find the CMD parameter on SBMJOB.
Command parameters *CMD
MBR The member to be processed. The special value *ALL
may be entered in which case all members in a file
will be checked. If the file contains many members,
this command should be submitted to batch.
SRCFILE The qualified CL source file name to be checked.
The file name defaults to QCLSRC. The library name
defaults to *LIBL.
PRINT Print options. *EXCPT is the default to print only
those members with exceptions. Every listing
includes the total number of statements and the
number of commands found. If this is needed for all
members, specify *ALL. If *EXCPT is specified and
no exceptions are found, a completion message is
sent (no listing is produced).
The special option *NONE is provided which can only
be specified if a single member is named. It
provides no printed output (the intent being that
you would monitor for TAA9897 to determine whether
CALLCMDS Call commands. The default is *NO meaning no CALL
or TFRCTL commands will be considered. *ONLY can be
specified to check for CALL and TFRCTL commands
only. *YES may be specified to include a check for
both CALL/TFRCTL commands and commands that do not
pass the checking.
TAACMDS Whether to include TAA commands. The default is
*NO may be specified to bypass TAA commands. If no
library qualifier is used, the definition of a TAA
command is one that exists in the TAATOOL library.
If a TAATOOL library qualifier is specified, the
command is still checked to see if it exists.
PRTERRORS Whether to print error conditions. The default is
*YES. Error conditions such as the command cannot
be found or invalid command syntax would be listed.
If OUTPUT is not *OUTFILE, the error conditions are
noted in the normal listing. If OUTPUT(*OUTFILE) is
used, a separate spooled file occurs for each member
with an error condition.
*NO may be specified to bypass the printing of error
conditions. If OUTPUT(*OUTFILE) is specified, the
outfile will contain an indication of an error
conditions (such as NOTFOUND or INVALID).
OUTPUT The type of output. * is the default and causes
spooled output. *OUTFILE may be specified to create
an outfile of the exceptions.
OUTFILELIB The library for the CMDFILP file. The default is
*LIBL. A specific library must be named if the
CMDFILP file does not already exist. The model file
in TAATOOL is TAACMDCP with a format name of CMDRCD.
If OUTPUT(*) is used, a library name may not be
REPLACE Whether the data in the CMDFILP file will be cleared
before new data is written. The default is *YES.
*NO may be specified to add new records to an
** See the previous exceptions.
** The source file must be 80 bytes of data.
** By default only the commands in QSYS are used to check
** The CMTAA field for TAA commands is set to *YES or *NO based
on whether the command exists in TAATOOL. This is not an
indication that the command will be run from TAATOOL unless a
library qualifier exists.
The following TAA Tools must be on your system:
EDTVAR Edit variable
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
The tool is ready to use for the i5/OS commands and a few Program
Product commands. You may further tailor the list of commands that
are considered valid. See the previous discussion.
Objects used by the tool
Object Type Attribute Src member Src file
------ ----- --------- ---------- -----------
CHK400CMD *CMD TAACMDC QATTCMD
TAACMDCC *PGM CLP TAACMDCC QATTCL
* TAACMDCC2 *PGM CLP TAACMDCC2 QATTCL
TAACMDCR *PGM RPG TAACMDCR QATTRPG
* TAACMDCR2 *PGM RPG TAACMDCR2 QATTRPG
No object TAACMDCR3 QATTRPG
TAACMDCR4 *PGM RPG No source
TAACMDCP *FILE PF TAACMDCP QATTDDS
* The programs are implicitly deleted after TAACMDCR4 is created