137 lines
8.0 KiB
HTML
137 lines
8.0 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="QCMDCHK program" />
|
||
|
<meta name="abstract" content="QCMDCHK is an IBM-supplied program that performs syntax checking for a single command, and optionally prompts for the command." />
|
||
|
<meta name="description" content="QCMDCHK is an IBM-supplied program that performs syntax checking for a single command, and optionally prompts for the command." />
|
||
|
<meta name="DC.subject" content="high-level language (HLL) program, QCMDCHK program, program, QCMDCHK, syntax checking, using, QCMDCHK program" />
|
||
|
<meta name="keywords" content="high-level language (HLL) program, QCMDCHK program, program, QCMDCHK, syntax checking, using, QCMDCHK program" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="clpgcmdAPIs.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../apis/qcmdchk.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="chckp" />
|
||
|
<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>QCMDCHK program</title>
|
||
|
</head>
|
||
|
<body id="chckp"><a name="chckp"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">QCMDCHK program</h1>
|
||
|
<div><p>QCMDCHK is an IBM-supplied program that performs syntax checking
|
||
|
for a single command, and optionally prompts for the command.</p>
|
||
|
<div class="section"> <p>The command is not run. If prompting is requested, the command
|
||
|
string is returned to the calling procedure or program with the updated values
|
||
|
as entered through prompting. The QCMDCHK program can be called from a CL
|
||
|
procedure or program or an HLL procedure or program.</p>
|
||
|
<p>Typical uses of
|
||
|
QCMDCHK are: </p>
|
||
|
<ul><li>Prompt the user for a command and then store the command for later processing.</li>
|
||
|
<li>Determine the options the user specified.</li>
|
||
|
<li>Log the processed command. First, prompt with QCMDCHK, run with QCMDEXC,
|
||
|
and then log the processed command.</li>
|
||
|
</ul>
|
||
|
<p>The format of the call to QCMDCHK is: </p>
|
||
|
<pre>CALL PGM(QCMDCHK) PARM(command command-length)</pre>
|
||
|
<p>The first parameter passed to QCMDCHK is a character string
|
||
|
containing the command to be checked or prompted. If the first parameter
|
||
|
is a variable and prompting is requested, the command entered by the workstation
|
||
|
user is placed in the variable.</p>
|
||
|
<p>The second parameter is the maximum
|
||
|
length of the command string being passed. If the command string is passed
|
||
|
as a quoted string, the command length is exactly the length of the quoted
|
||
|
string. If the command string is passed in a variable, the command length
|
||
|
is the length of the CL variable. The second parameter must be a packed decimal
|
||
|
value of length 15 with 5 decimal positions.</p>
|
||
|
<p>The QCMDCHK program performs
|
||
|
syntax checking on the command string which is passed to it. It verifies
|
||
|
that all required parameters are coded, and that all parameters have allowable
|
||
|
values. It does not check for the processing environment. That is, a command
|
||
|
can be checked whether it is allowed in batch only, interactive only, or only
|
||
|
in a batch or interactive CL program. QCMDCHK does not allow checking of
|
||
|
command definition statements.</p>
|
||
|
<p>If a syntax error is detected on the
|
||
|
command, message CPF0006 is sent. You can monitor for this message to determine
|
||
|
if an error occurred on the command. Message CPF0006 is preceded by one or
|
||
|
more diagnostic messages that identify the error. In the following example,
|
||
|
control is passed to the label ERROR within the program, because the value
|
||
|
123 is not valid for the PGM parameter of the <span class="cmdname">Create CL Program (CRTCLPGM)</span> command.
|
||
|
</p>
|
||
|
<pre>CALL QCMDCHK ('CRTCLPGM PGM(QGPL/123)' 22)
|
||
|
MONMSG CPF0006 EXEC(GOTO ERROR)</pre>
|
||
|
<p>You can request prompting for the command by either placing
|
||
|
a question mark before the command name or by placing selective prompt characters
|
||
|
before one or more keyword names in the command string.</p>
|
||
|
<p>If no errors
|
||
|
are detected during checking and prompting for the command, the updated command
|
||
|
string is placed in the variable specified for the first parameter. The prompt
|
||
|
request characters are removed from the command string. This is shown in
|
||
|
the following example: </p>
|
||
|
<pre>DCL &CMD *CHAR 2000
|
||
|
.
|
||
|
.
|
||
|
CHGVAR &CMD '?CRTCLPGM'
|
||
|
CALL QCMDCHK (&CMD 2000)</pre>
|
||
|
<p>After the call to the QCMDCHK program is run, variable &CMD
|
||
|
contains the command string with all values entered through the prompter.
|
||
|
This might be something like: </p>
|
||
|
<pre>CRTCLPGM PGM(PGMA) SRCFILE(TESTLIB/SOURCE) USRPRF(*OWNER)</pre>
|
||
|
<p>Note that the question mark preceding the command name is removed.</p>
|
||
|
<p>When
|
||
|
prompting is requested through the QCMDCHK program, the command string should
|
||
|
be passed in a CL variable. Otherwise, the updated command string is not
|
||
|
returned to your procedure or program. You must also be sure that the variable
|
||
|
for the command string is long enough to contain the updated command string
|
||
|
which is returned from the prompter. If it is not long enough, message CPF0005
|
||
|
is sent, and the variable containing the command string is not
|
||
|
changed. Without selective prompting, the prompter only returns entries that
|
||
|
were typed by the user.</p>
|
||
|
<p>The length of the variable is determined by
|
||
|
the value of the second parameter, and not the actual length of the variable.
|
||
|
In the following example, escape message CPF0005 is sent because the specified
|
||
|
length is too short to contain the updated command, even though the variable
|
||
|
was declared with an adequate length. </p>
|
||
|
<pre>DCL &CMD *CHAR 2000
|
||
|
.
|
||
|
.
|
||
|
CHGVAR &CMD '?CRTCLPGM'
|
||
|
CALL QCMDCHK (&CMD 9)</pre>
|
||
|
<p>If you press F3 or F12 to exit from the prompter while running
|
||
|
QCMDCHK, message CPF6801 is sent to the procedure or program that called QCMDCHK,
|
||
|
and the variable containing the command string is not changed.</p>
|
||
|
<p>If PASSATR(*YES)
|
||
|
is specified on the PARM, ELEM, or QUAL command definition statement, and
|
||
|
the default value is changed using the <span class="cmdname">Change Command Definition
|
||
|
(CHGCMDDFT)</span> command, the default value is highlighted as though
|
||
|
this was a user-specified value and not a default value. If a default value
|
||
|
of a changed PARM, ELEM, or QUAL command definition statement is changed back
|
||
|
to its original default value, the default value will no longer be highlighted.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<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="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/qcmdchk.htm">Check Command Syntax (QCMDCHK) API</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|