The Display Prompted Command function prompts for a command and uses
the returned string to 1) run the command via user specified QCMDEXC
program, 2) parse the returned string into 68 byte blocks to be
displayed, printed, sent to the job log, or written to a source
member. Variables may be specified for the parameters of the command
to be prompted for and will be filled at execution time. The
variables must be declared in the program.
The RTVPMTCMD tool is used internally to return a string.
A simple use of DSPPMTCMD would be:
DSPPMTCMD CMDIN(CHKOBJ)
The CHKOBJ command prompt would appear. If you entered the object
name of FILEA and a type of *FILE, the following would be generated:
CHKOBJ OBJ(FILEA) OBJTYPE(*FILE)
Because the default is OUTPUT(*), a spooled file would be displayed
with the generated command records (in this case only a single
record).
Because the default is for CMDPRCTYP(*CLP), you may enter a variable
name when the prompt appears. If the variable &FILE had been entered
for the file when the prompt appears, the return command record would
be:
CHKOBJ OBJ(&FILE) OBJTYPE(*FILE)
If OUTPUT(*SRCMBR) had been specified and the defaults for SRCFILE
and SRCMBR used, a source record would have been written to the end
of the TEMP member in source file TEMP in QTEMP with the same
information (the source file and source member would have been
created if needed). The source statement could then be moved to the
appropriate place within the source (or a different source member)
and F4 used for prompting to format the command within the source
member.
DSPPMTCMD escape messages you can monitor for
---------------------------------------------
None. Escape messages from based on functions will be re-sent.
DSPPMTCMD Command parameters *CMD
----------------------------
CMDIN The command or command string to be prompted for.
Up to 2500 bytes may be entered.
CMDPRCTYP The command processing type describes what the
intent is for use of the returned string.
The default is *CLP meaning you want the command
returned for use in a CL program. If you are
returning the command for use in a source member, a
value other than *CMDLINE should be used and you
must describe the type of source that will be used
as not all source types are valid. For example,
CALLPRC is only valid in a CLLE source type. Note
that no formatting of the returned string occurs to
fit in the length of the statement for each source
record.
If you are going to use the command with QCMDEXC,
*CMDLINE should be used.
*CLP is the default to return the command for
intended use in CL program source. This allows a
command such as RTVJOBA to be prompted for.
Variables are allowed.
*CLLE may be specified to return the command for
intended use in CLLE program source. Variables are
allowed.
*CMDLINE may be specified to return the prompted
command as a string intended to be executed using
QCMDEXC. Variables are not allowed. Commands that
return variables such as RTVJOBA are not allowed.
If an invalid keyword exists in the input string,
the command prompt would occur with a message
stating the error in the same manner as if the
command had been entered interactively and prompted
for with F4.
*CLINPSTR may be specified to return the command for
an ILE CL source type intended to be executed as as
a string. This prevents the use of commands that
return variables such as RTVJOBA. The valid
commands must be specified as being allowed in an
*IMOD or *BMOD type program.
*CMDDEF may be specified to return the command for
command definition source. The only valid commands
that may be entered are CMD, PARM, ELEM, QUAL, DEP,
and PMTCTL.
OUTPUT How to output the results. * is the default to
display the spooled file if the command is entered
interactively. The spooled file is deleted after it
is displayed.
*PRINT may be specified to output to a spooled file.
*JOBLOG may be entered to output the command as a
series of messages to the job log.
*SRCMBR may be entered to write the output to a
source member. See also the SRCFILE and MBR
parameters.
SRCFILE The qualified source file to write output to if
OUTPUT(*SRCMBR) is specified. The default is file
TEMP in QTEMP. If the file does not exist, it is
created with a record length of 112.
SRCMBR The member of the source file to be used if
OUTPUT(*SRCMBR) is specified. The default is TEMP.
If the member does not exist, it is added. The
source type is assigned based on the CMDPRCTYP
specified such as CLP is assigned for the use of
*CLP or *CLPCHGVAR.
Restrictions
------------
None.
Prerequisites
-------------
The following TAA Tools must be on your system:
EDTVAR Edit variable
EXCOUTPUT Execute output
RTVPMTCMD Retrieve prompted command
SNDCOMPMSG Send completion message
SNDESCINF Send escape information
SNDESCMSG Send escape message
SNDJLGMSG Send job log message
SNDSTSMSG Send status message
WRTSRC Write source
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
DSPPMTCMD *CMD TAACMFK QATTCMD
TAACMFKC *PGM CLP TAACMFKC QATTCL
TAACMFKR *PGM RPGLE TAACMFKR QATTRPG
TAACMFKR2 *PGM RPGLE TAACMFKR2 QATTRPG
|