ibm-information-center/dist/eclipse/plugins/i5OS.ic.cl_5.4.0.1/dep.htm

304 lines
15 KiB
HTML

<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Dependent Definition (DEP)</title>
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body bgcolor="white">
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<a name="DEP.Top_Of_Page"></a>
<h2>Dependent Definition (DEP)</h2>
<table width="100%">
<tr>
<td valign="top" align="left"></td>
<td valign="top" align="right">
<a href="#DEP.PARAMETERS.TABLE">Parameters</a><br>
<a href="#DEP.COMMAND.EXAMPLES">Examples</a><br>
<a href="#DEP.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="DEP"></a>
<p>The Dependent Definition (DEP) command definition statement defines a required relationship between parameters and parameter values that must be checked. This relationship can refer to either the specific value of a parameter or parameters, or to the required presence of parameters.
</p>
<p>DEP statements provide a second level of parameter syntax checking for a CL command. The first level is provided by the PARM, QUAL, and ELEM statements that define the type of value (like *NAME or *DATE), as well as parameter value restrictions such as a the range of valid values or a list of valid values. DEP statements allow you to verify that combinations of parameter values are syntactically correct within the command string.
</p>
<p>DEP statements can only check the first value of a specified parameter. If you want to do syntax checking for a parameter that accepts a list of values or a parameter with multiple elements or qualifiers, a validity checking exit program can be written to do a third level of syntax check for the command string. Doing syntax checking in the PARM, QUAL, ELEM or DEP statements, or in a validity checking program, can remove or greatly simplify parameter syntax checking code in your command processing program.
</p>
<p>If a parameter has a default value and the parameter is not specified, the checking differs depending on whether the DEP statement is performing a specification check or a relational check. If a <i>specification</i> check is made on an unspecified parameter (checking for the presence of a value for that parameter), the system assumes that no value was specified, and the default value is <i>not</i> used. If a <i>relational</i> check is made on an unspecified parameter, the default value is used as the parameter value in the relational check.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#DEP.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="DEP.PARAMETERS.TABLE">Parameters</a></h3>
<table border="1" cellpadding="4" cellspacing="0">
<!-- col1="10" col2="15" col3="30" col4="10" -->
<tr>
<th bgcolor="aqua" valign="bottom" align="left">Keyword</th>
<th bgcolor="aqua" valign="bottom" align="left">Description</th>
<th bgcolor="aqua" valign="bottom" align="left">Choices</th>
<th bgcolor="aqua" valign="bottom" align="left">Notes</th>
</tr>
<tr>
<td valign="top" rowspan="4"><a href="#DEP.CTL"><b>CTL</b></a></td>
<td valign="top">Controlling conditions</td>
<td valign="top">Single values: *ALWAYS<br>Other values: <i>Element list</i></td>
<td valign="top" rowspan="4">Required, Positional 1</td>
</tr>
<tr>
<td valign="top">Element 1: Keyword or keyword reference</td>
<td valign="top">
<i>Character value</i></td>
</tr>
<tr>
<td valign="top">Element 2: Relational operator</td>
<td valign="top">
*GT, *EQ, *GE, *NL, *LT, *NE, *LE, *NG</td>
</tr>
<tr>
<td valign="top">Element 3: Value or keyword reference</td>
<td valign="top">
<i>Character value</i></td>
</tr>
<tr>
<td valign="top" rowspan="4"><a href="#DEP.PARM"><b>PARM</b></a></td>
<td valign="top">Dependent parameter</td>
<td valign="top">Values (up to 25 repetitions): <i>Element list</i></td>
<td valign="top" rowspan="4">Required, Positional 2</td>
</tr>
<tr>
<td valign="top">Element 1: Keyword or keyword reference</td>
<td valign="top">
<i>Character value</i></td>
</tr>
<tr>
<td valign="top">Element 2: Relational operator</td>
<td valign="top">
*GT, *EQ, *GE, *NL, *LT, *NE, *LE, *NG</td>
</tr>
<tr>
<td valign="top">Element 3: Value or keyword reference</td>
<td valign="top">
<i>Character value</i></td>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#DEP.NBRTRUE"><b>NBRTRUE</b></a></td>
<td valign="top">Number of true dependencies</td>
<td valign="top">Single values: <b><u>*ALL</u></b><br>Other values: <i>Element list</i></td>
<td valign="top" rowspan="3">Optional, Positional 3</td>
</tr>
<tr>
<td valign="top">Element 1: Relational operator</td>
<td valign="top">
*GT, *EQ, *GE, *NL, *LT, *NE, *LE, *NG</td>
</tr>
<tr>
<td valign="top">Element 2: Number to be true</td>
<td valign="top">
0-25</td>
</tr>
<tr>
<td valign="top"><a href="#DEP.MSGID"><b>MSGID</b></a></td>
<td valign="top">Message identifier</td>
<td valign="top"><i>Name</i>, <b><u>*NONE</u></b></td>
<td valign="top">Optional, Positional 4</td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#DEP.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="DEP.CTL"></a>
<h3>Controlling conditions (CTL)</h3>
<p>Specifies the controlling conditions that must be true before the parameter dependencies defined in the PARM statement must be true. The first keyword specified identifies the controlling parameter. The controlling condition can be specified by a keyword name only, or by a keyword name and a test relationship that determines whether the controlling condition requires the presence of the parameters it depends on. The relationship between the controlling parameter and a specified value can be tested to determine if the condition specified is met. If it is, the parameters that the controlling parameter depends on must meet the requirements specified in the PARM and NBRTRUE keywords.
</p>
<p><b>Single values</b>
</p>
<dl>
<dt><b>*ALWAYS</b></dt>
<dd>The parameter dependency is always checked, regardless of the form of the command.
</dd>
</dl>
<p><b>Other values</b>
</p>
<dl>
<dt><b><i>keyword-name</i></b></dt>
<dd>Specify the keyword name of the parameter for which a value must be specified to control dependency. The keyword name is the name of the parameter that was specified by the <b>Keyword (KWD)</b> parameter on the PARM statement defining it. If the keyword was specified, the parameter dependency is checked. The keyword name cannot refer to a command parameter defined with TYPE(*NULL).
</dd>
</dl>
<dl>
<dt><b><i>&amp;keyword-name relational-operator value</i></b></dt>
<dd>Specify the keyword name of the controlling parameter followed by a relational operator (such as *LE or *EQ) and a value to be tested. If the tested condition is met, the parameters that the controlling parameter depends on must meet the requirements specified for the PARM keyword. The value must be no longer than 32 characters. The keyword name cannot refer to a command parameter defined with TYPE(*NULL).
<p>If the value being tested against has been specified as a special value or single value, using the SPCVAL parameter or the SNGVAL parameter of the PARM statement, the to-value must be used rather than the from-value.
</p>
<p>The keyword name must be preceded by an ampersand (&amp;) to indicate that the value of the keyword is tested if the relational operator and value are specified; the ampersand must not be used if the relational operator and value are not specified.
</p>
</dd>
</dl>
<dl>
<dt><b><i>(&amp;keyword-name relational-operator &amp;keyword-name)</i></b></dt>
<dd>Specify the keyword name of the controlling parameter followed by a relational operator (such as *EQ) and the keyword name of another parameter whose value is compared with the value of the controlling parameter. The keyword names cannot refer to command parameters defined with TYPE(*NULL) or PASSVAL(*NULL).
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#DEP.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="DEP.PARM"></a>
<h3>Dependent parameter (PARM)</h3>
<p>Specifies the parameter dependencies that must be tested if the controlling conditions defined by the CTL parameter are true. The dependencies can be the names of one or more parameters that are tested for their presence, or one or more test relationships of keyword values to other keyword values or constant values. A maximum of 25 parameter dependencies can be specified for this parameter. Keyword names cannot refer to command parameters defined with TYPE(*NULL).
</p>
<dl>
<dt><b><i>keyword-name</i></b></dt>
<dd>Specify the keyword name of each parameter that must have a value specified for it.
</dd>
</dl>
<dl>
<dt><b><i>&amp;keyword-name relational-operator value</i></b></dt>
<dd>Specify the keyword name of each parameter followed by a relational operator and a value to be tested. An ampersand must precede the keyword name to indicate that the value of the keyword is tested. The value must be no longer than 32 characters.
<p>If the value being tested against has been specified as a special value or single value, using the <b>Special values (SPCVAL)</b> parameter or the <b>Single values (SNGVAL)</b> parameter of the PARM statement, the to-value must be used rather than the from-value.
</p>
</dd>
</dl>
<dl>
<dt><b><i>&amp;keyword-name relational-operator &amp;keyword-name</i></b></dt>
<dd>Specify the keyword name of one parameter followed by a relational operator and the keyword name of another parameter whose value is compared with the value of the first parameter. The keyword names cannot refer to command parameters defined with PASSVAL(*NULL).
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#DEP.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="DEP.NBRTRUE"></a>
<h3>Number of true dependencies (NBRTRUE)</h3>
<p>Specifies the number of parameter dependencies (defined in the PARM parameter on this DEP statement) that must be true. Otherwise, a diagnostic message (defined in the MSGID parameter on this DEP statement) is sent and the command is not run.
</p>
<p>CL variables cannot be coded for either element of this parameter.
</p>
<p><b>Single values</b>
</p>
<dl>
<dt><b><u>*ALL</u></b></dt>
<dd>All the parameter dependencies must be true. This is the same as specifying NBRTRUE(*EQ <b>n</b>), where <b>n</b> is the number of parameter dependencies defined in the PARM parameter.
</dd>
</dl>
<p><b>Element 1: Relational operator</b>
</p>
<dl>
<dt><b><i>relational-operator</i></b></dt>
<dd>Specify a relational operator. Valid values are *GT, *EQ, *GE, *NL, *LT, *NE, *LE, and *NG.
</dd>
</dl>
<p><b>Element 2: Number to be true</b>
</p>
<dl>
<dt><b><i>0-25</i></b></dt>
<dd>Specify the number of parameter dependencies that must be true to satisfy the specified relationship.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#DEP.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="DEP.MSGID"></a>
<h3>Message identifier (MSGID)</h3>
<p>Specifies the diagnostic message that is to be sent to the user if the logical expression specified by the NBRTRUE parameter evaluates as <b>false</b>.
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>No specific diagnostic message is sent. Instead, generic message CPD0150 is sent. Depending on the number of parameters on the command, it can be very difficult to determine the cause of the interparameter syntax error from the generic message text.
</dd>
<dt><b><i>message-identifier</i></b></dt>
<dd>Specify the message identifier of the diagnostic message sent to the user.
<p>Messages whose identifiers begin with the 3-character prefixes <i>CPF</i> or <i>CPD</i> are retrieved from the IBM-supplied message file QCPFMSG. All other messages specified here are retrieved from the message file identified by the MSGF parameter on the CRTCMD command which is used to create the command being defined with these dependencies. Variables cannot be coded for this parameter.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#DEP.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="DEP.COMMAND.EXAMPLES">Examples</a> </h3>
<p><b>Example 1: Checking the Presence of a Parameter</b>
</p>
<p>
<pre>
DEP CTL(&amp;TYPE *EQ LIST) PARM(ELEMLIST)
</pre>
</p>
<p>If TYPE(LIST) is specified, the ELEMLIST parameter must be specified. If TYPE(LIST) and no value is specified for the ELEMLIST parameter, generic diagnostic message CPD0150 is sent and the command is not run.
</p>
<p><b>Example 2: Checking the Presence of Multiple Parameters</b>
</p>
<p>
<pre>
DEP CTL(FILE) PARM(VOL LABEL) +
NBRTRUE(*EQ 2) MSGID(USR1234)
</pre>
</p>
<p>If the FILE parameter is specified, both the VOL and LABEL parameters must be specified. If only one of the VOL and LABEL parameters have a value specified, or if neither parameter is specified, diagnostic message USR1234 is sent and the command is not run. Command analyzer will look for message USR1234 in the message file specified for the MSGF parameter on the CRTCMD command.
</p>
<p><b>Example 3: Checking for Mutually Exclusive Parameters</b>
</p>
<p>
<pre>
DEP CTL(*ALWAYS) PARM(J1 D J2) NBRTRUE(*EQ 1)
</pre>
</p>
<p>A value must be specified for one (and only one) of the J1, D, and J2 parameters. If zero or two or three of these parameters are specified, generic diagnostic message CPD0150 is sent and the command is not run.
</p>
<p><b>Example 4: Checking One or More Conditions are True</b>
</p>
<p>
<pre>
DEP CTL(&amp;LIB *EQ MYLIB) +
PARM((&amp;PASSWORD *EQ XYZ5) (&amp;USRPRF *EQ B0BJ)) +
NBRTRUE(*GE 1) MSGID(MSG1001)
</pre>
</p>
<p>If the LIB parameter value is MYLIB, the PASSWORD parameter value must be XYZ5, or the USRPRF parameter value must be BOBJ, or both PASSWORD(XYZ5) and USRPRF(BOBJ) must be specified. If LIB(MYLIB) and neither of the dependency conditions specified are true, diagnostic message MSG1001 is sent and the command is not run.
</p>
<p><b>Example 5: Checking for a Conditionally Required Parameter</b>
</p>
<p>
<pre>
DEP CTL(&amp;OUTPUT *EQ *OUTFILE) PARM((&amp;OUTFILE *NE ' ')) +
NBRTRUE(*EQ 1) MSGID(CPD9861)
DEP CTL(&amp;OUTPUT *NE *OUTFILE) PARM((&amp;OUTFILE *EQ ' ')) +
NBRTRUE(*EQ 1) MSGID(CPD9862)
DEP CTL(&amp;OUTMBR *NE *FIRST) PARM((&amp;OUTFILE *EQ ' ')) +
NBRTRUE(*EQ 0) MSGID(CPD9867)
</pre>
</p>
<p>Three related interparameter checks will be made:
</p>
<ol>
<li>If the OUTPUT parameter has a value of *OUTFILE, the OUTFILE parameter must have a non-blank value specified. Otherwise, message CPD9861 is sent. Since the message identifier starts with 'CPD', the operating system will look for the message in message file QCPFMSG. Assuming the OUTFILE parameter is a qualified object name, only the value of the first QUAL will be checked.
</li>
<li>If the OUTPUT parameter has a value other than *OUTFILE, the OUTFILE parameter must be blank, assuming that the OUTFILE parameter was coded as MIN(0) and with no default (DFT) value. Otherwise, message CPD9862 is sent.
</li>
<li>If the OUTMBR parameter has any value other than *FIRST, the OUTFILE parameter must have a non-blank value specified. Otherwise, message CPD9867 is sent. Assuming the OUTMBR parameter is a list of two elements, only the value of the first ELEM will be checked.
</li>
</ol>
</div>
<table width="100%">
<tr><td align="right"><a href="#DEP.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="DEP.ERROR.MESSAGES">Error messages</a> </h3>
<p>None
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#DEP.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>