ibm-information-center/dist/eclipse/plugins/i5OS.ic.rbam6_5.4.0.1/execp.htm

132 lines
8.1 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="task" />
<meta name="DC.Title" content="QCMDEXC program" />
<meta name="abstract" content="Execute Command (QCMDEXC) is an IBM-supplied program that runs a single command." />
<meta name="description" content="Execute Command (QCMDEXC) is an IBM-supplied program that runs a single command." />
<meta name="DC.subject" content="high-level language (HLL) program, QCMDEXC program, HLL (high-level language) program, run command from program" />
<meta name="keywords" content="high-level language (HLL) program, QCMDEXC program, HLL (high-level language) program, run command from program" />
<meta name="DC.Relation" scheme="URI" content="clpgcmdAPIs.htm" />
<meta name="DC.Relation" scheme="URI" content="excdb.htm" />
<meta name="DC.Relation" scheme="URI" content="workv.htm" />
<meta name="DC.Relation" scheme="URI" content="msghd.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/qcmdexc.htm" />
<meta name="DC.Relation" scheme="URI" content="secpr.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="execp" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>QCMDEXC program</title>
</head>
<body id="execp"><a name="execp"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">QCMDEXC program</h1>
<div><p>Execute Command (QCMDEXC) is an IBM-supplied program that runs
a single command. </p>
<div class="section"> <div class="p"> This command is used to activate another command: <ul><li>From within a high-level language (HLL) program.</li>
<li>From within a CL procedure.</li>
<li>From a program where it is not known at compile time what command is to
be run or what parameters are to be used.</li>
</ul>
</div>
<p>The QCMDEXC program is called from within the HLL or CL procedure
or program. The command that is to be run is passed as a parameter on the
CALL command.<br /><img src="rbafn558.gif" alt="The QCMDEXC program is called from within the HLL or CL procedure or program. The command that is to be run is passed as a parameter on the CALL command." /><br /></p>
<p>After the command runs,
control returns to your HLL or CL procedure or program.</p>
<p>The command
runs as if it was not in a program. Therefore, variables cannot be used on
the command because values cannot be returned by the command to CL variables.
Additionally, commands that can only be used in CL procedures or programs
cannot be run by the QCMDEXC program. The format of the call to the QCMDEXC
program is the following: </p>
<pre>CALL PGM(QCMDEXC) PARM(command command-length)</pre>
<p>Enter the command you wish to run as a character string on
the first parameter. You must specify the command library. </p>
<pre>CALL PGM(QCMDEXC ) PARM('QSYS/CRTLIB LIB(TEST)' 22)</pre>
<p>Remember that you must enclose the command in apostrophes if
it contains blanks. The maximum length of the character string is 6000 characters;
never count the delimiters (the apostrophes ) as part of the string. The length
that is specified as the second value on the PARM parameter is the length
of the character string that is passed as the command. Length must be a packed
decimal value of length 15 with 5 decimal positions.</p>
<p>Thus, to replace
a library list, the call to the QCMDEXC program would look like this: </p>
<pre>CALL PGM(QCMDEXC) PARM('CHGLIBL LIBL(QGPL NEWLIB QTEMP)' 31)</pre>
<p>It is possible to code this statement into the HLL or CL program
to replace the library list when the program runs. The QCMDEXC program does
not provide runtime flexibility when used this way.</p>
<p>Providing runtime
flexibility is accomplished by: </p>
<ol><li>Substituting variables for the constants in the parameter list, and</li>
<li>Specifying the values for the variables in the call to the HLL or CL program.</li>
</ol>
<div class="p">For instance, examine the following figure: <div class="fignone"><span class="figcap">Figure 1. Example of
Call PGM</span><br /><img src="rbafn500.gif" alt="Example of Call PGM" /><br /></div>
</div>
<p>The command length, passed to the QCMDEXC program on the second
parameter, is the maximum length of the passed command string. Should the
command string be passed as a quoted string, the command length is exactly
the length of the quoted string. Should the command string be passed in a
variable, the command length is the length of the CL variable. It is not necessary
to reduce the command length to the actual length of the command string in
the variable, although it is permissible to do so.</p>
<p>Not all commands
can be run using the QCMDEXC program. The command passed on a call to the
QCMDEXC program must be valid within the current environment (interactive
or batch) in which the call is being made. The command cannot be one of the
following: </p>
<ul><li>An input stream control command (BCHJOB, ENDBCHJOB, and DATA)</li>
<li>A command that can be used only in a CL program</li>
</ul>
<p>You can precede the CL command with a question mark (?) to request
prompting or use selective prompting when you call QCMDEXC in an interactive
job.</p>
<p>If an error is detected while a command is being processed through
the QCMDEXC program, an escape message is sent. You can monitor for this escape
message in your CL procedure or program using the <span class="cmdname">Monitor Message
(MONMSG)</span> command.</p>
<p>If a syntax error is detected, message CPF0006
is sent. If an error is detected during the processing of a command, any escape
message sent by the command is returned by the QCMDEXC program. You monitor
for messages from commands run through the QCMDEXC program in the same way
you monitor for messages from commands contained in CL procedures and programs.</p>
<p>See
the appropriate high level language reference book for information on how
high level language programs handle errors on calls.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="excdb.htm">QCMDEXC program with DBCS data</a></strong><br />
You can use QCMDEXC to request double-byte character set (DBCS) input data to be entered with a command.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="clpgcmdAPIs.htm" title="This describes application programming interfaces (APIs) and programs that can be used when working with commands.">Use command-related APIs</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="workv.htm" title="CL procedures consist of CL commands, and the commands themselves consist of the command statement, parameters, and parameter values.">Use variables</a></div>
<div><a href="msghd.htm" title="Predefined messages are stored in a message file.">Define message descriptions</a></div>
<div><a href="secpr.htm" title="You can request to prompt for selected parameters within a command.">Use selective prompting for CL commands</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../apis/qcmdexc.htm">Execute Commands (QCMDEXC) API</a></div>
</div>
</div>
</body>
</html>