EXCCMD EXECUTE COMMANDS IN A SOURCE MEMBER TAACMDD |
The EXCCMD command executes one or more commands stored in a source
member. The command is helpful when you want to execute a stream of
commands without submitting the commands to batch. The commands are
executed synchronously. This means the EXCCMD will not complete
until all commands in the source member are executed.
The commands in the source member must not have a JOB, PGM or ENDPGM
command. The commands should be entered by SEU or written to the
source member by a HLL program or by a function such as the TAA Tool
CPYJOBLOG.
EXCCMD can also be executed from a HLL program to execute a series of
stored CL commands. The default source file for the command is
QCLSRC.
A typical command would look like:
EXCCMD MBR(CLCMDS)
The member CLCMDS in the file QCLSRC would be accessed and the
commands within the member would be executed.
A typical use of EXCCMD is in conjunction with TAA Tool CPYJOBLOG
command. For example, assume you have entered a series of commands
using the command entry display and now need to execute the exact
same series of commands. Rather than duplicating each of the
commands, you could:
** Use CPYJOBLOG to copy the commands to a source file member
** Edit the commands with SEU
** Execute the commands with EXCCMD
The EXCCMD command operates on any source file that can be maintained
by SEU (240 byte maximum). Commands can be longer than a single
source statement assuming the proper + or - ending symbol is used.
Comments can exist in the source.
A parameter exists to determine what to do if errors exist. The
default is to abort which causes all commands to be executed and then
EXCMD ends with an escape message if any errors occurred. You can
request to end immediately on the first error or request that errors
be bypassed.
Command parameters *CMD
------------------
MBR The member name which contains the CL source to be
executed. If the member does not exist, an escape
message will occur.
SRCFILE The qualified source file name. The file name
defaults to QCLSRC and the library to *LIBL.
*CURLIB may also be specified.
CMDERR Determines what to do on command errors or if no
commands exist to be executed.
*ABORT is the default and causes the EXCCMD command
to send an escape message if a command fails. The
escape message which caused the error is resent for
the command being executed. If no commands exist to
be executed, CPF9898 is sent as an escape message.
*ABORT does not cause EXCCMD to send an escape
message until all commands have been executed.
*ABORT2 causes EXCCMD to send an escape message on
the first command that fails.
If *BYPASS is specified, the EXCCMD command will
successfully execute and will return a completion
message regardless of whether command errors
occurred or any commands existed.
If a completion message is sent, the text of the
completion message will differ depending on whether
errors were found or no commands existed.
If *NOCMDS is specified, an escape message will be
sent if a command fails, but a completion message is
sent if no commands exist to be executed.
PRTSRC Determines if the source member should be printed.
*NO is the default to not print the member.
*YES may be specified to always print the member.
*ERROR may be specified to print the member only if
a command in the source has failed.
Restrictions
------------
A command up to approximately 5,000 bytes in length may be executed.
Prerequisites
-------------
The following TAA Tools must be on your system:
EDTVAR Edit variable
RMVLSTMSG Remove last message
SNDCOMPMSG Send completion message
SNDDIAGMSG Send diagnostic message
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ----- --------- ---------- -----------
EXCCMD *CMD TAACMDD QATTCMD
TAACMDDC *PGM CLP TAACMDDC QATTCL
TAACMDDR *PGM RPG TAACMDDR QATTRPG
|
Added to TAA Productivity tools April 1, 1995