The Execute Command Check command performs a syntax check of a
command similar to QCMDCHK. However, instead of using QCMDCHK, the
API QCAPCMD is used which causes the keywords to be added to the
command string in addition to checking for valid syntax.
The intended use of the tool is for an application that needs to
request a command from a user that will be stored in a data base file
and executed later.
You may choose to prompt for the command with PROMPT(*YES).
The tool would normally be used in a HLL program, but can be used in
CL such as:
DCL &RTNCMD *CHAR LEN(3000)
EXCCMDCHK CMD(xxxx) CMDLEN(nnn) RTNCMD(&RTNCMD) +
The RTNCMD parameter must be declared as 3000 bytes, but you can then
move the value to a smaller variable. An optional parameter exists
for the length of the returned command.
Two optional parameters exist to allow the return of any escape
message IDs and the message text. If these are coded, the command
will always complete normally and the program is expected to test the
ERRMSGID return variable to determine if errors exist. If the
parameter is not specified, the command resends any escape messages
HLL Parameter list
The tool is intended to be used from a HLL. The following are RPG
specifications in the proper format to use the tool. First use
CPYTAA TAAARCMBR(EXCCMDCHK) to copy the source from this
documentation member to QATTINFO in TAATOOL.
IRTNCMD DS 3000
I 1 100 RTNCM2
C* Place the command to be checked in the field CMD
C CALL 'TAACLQCC'
C PARM CMD 100
C PARM 100 CMDLEN 50
C PARM RTNCMD
C PARM '*YES' PROMPT 4
C PARM RTNLEN 50
C PARM ERRMSG 7
C PARM ERRTXT256
C* Ensure return length does not exceed your area
C RTNLEN IFGT nnn
C* Handle error
C* Move to your field for storing in data base
C MOVELRTNCMD xxx
Command parameters *CMD
CMD The command to be checked and have its keywords
inserted. The command can be up to 3000 bytes in
If the CMD value is blank, the user will see the
'Major Command Groups' menu and can choose a
command. Although a command line exists on the
menu, the system prevents its use.
CMDLEN The length of the command to be checked. It can be
a maximum of 3000, but a shorter length improves
RTNCMD The return command with keywords filled in. This is
a required parameter and must be declared as *CHAR
LEN(3000). You can move the returned command to a
shorter variable, but you should check the RTNLEN
parameter to see if it will fit.
PROMPT A *YES/*NO value for whether prompting will be used
before the command is returned. The default is *NO.
If the command is executed interactively, you may
allow the user to fill in the prompts for the
RTNLEN An optional return variable that if specified must
be declared as *DEC LEN(5 0). It will contain the
length of the command string returned. If the
command exceeds 3000 bytes, the length returned will
be the full length even though it is not available.
ERRMSGID An optional return variable that if specified must
be declared as *CHAR LEN(7). If specified, the
command does not end with any escape messages, but
rather returns the message ID of the escape message.
If no errors are found, the value will be blank.
ERRTXT An optional return variable that if specified must
be declared as *CHAR LEN(256). It will contain the
first level text of any escape message. If no
errors are found, the value will be blank.
Because the command returns variables, it can only be used in a CL
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
EXCCMDCHK *CMD TAACLQC QATTCMD
TAACLQCC *PGM CLP TAACLQCC QATTCL