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

111 lines
6.9 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="reference" />
<meta name="DC.Title" content="%SWITCH built-in function" />
<meta name="abstract" content="The switch built-in function (%SWITCH) compares one or more of eight switches with the eight switch settings already established for the job and returns a logical value of '0' or '1'." />
<meta name="description" content="The switch built-in function (%SWITCH) compares one or more of eight switches with the eight switch settings already established for the job and returns a logical value of '0' or '1'." />
<meta name="DC.subject" content="%SWITCH (switch) function, switch function" />
<meta name="keywords" content="%SWITCH (switch) function, switch function" />
<meta name="DC.Relation" scheme="URI" content="contp.htm" />
<meta name="DC.Relation" scheme="URI" content="ifcd.htm" />
<meta name="DC.Relation" scheme="URI" content="chgv.htm" />
<meta name="DC.Relation" scheme="URI" content="valuv.htm" />
<meta name="DC.Relation" scheme="URI" content="../clfinder/finder.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/chgjob.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/sbmjob.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/chgjobd.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/chgvar.htm" />
<meta name="DC.Relation" scheme="URI" content="rbam6builtinfunc.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="switc" />
<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>%SWITCH built-in function</title>
</head>
<body id="switc"><a name="switc"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">%SWITCH built-in function</h1>
<div><p>The switch built-in function (%SWITCH) compares one or more of
eight switches with the eight switch settings already established for the
job and returns a logical value of '0' or '1'. </p>
<div class="section"><p>The initial values of the switches for the job are determined
first by the <span class="cmdname">Create Job Description (CRTJOBD)</span> command;
the default value is <samp class="codeph">00000000</samp>. You can change this if necessary
using the SWS parameter on the <span class="cmdname">Submit Job (SBMJOB)</span>, <span class="cmdname">Change
Job (CHGJOB)</span>, or JOB command; the default for these is the job description
setting. Other high-level languages may also set job switches.</p>
<p>If,
in the comparison of your %SWITCH values against the job values, every switch
is the same, a logical value of '1' (true) is returned. If any switch tested
does not have the value indicated, the result is a '0' (false).</p>
<p>The
syntax of the %SWITCH built-in function is: </p>
<pre>%SWITCH(8-character-mask)</pre>
<p>The 8-character mask is used to indicate which job switches
are to be tested, and what value each switch is to be tested for. Each position
in the mask corresponds with one of the eight job switches in a job. Position
1 corresponds with job switch 1, position 2 with switch 2, and so on. Each
position in the mask can be specified as one of three values: 0, 1, or X.</p>
<dl><dt class="dlterm">0</dt>
<dd>The corresponding job switch is to be tested for a 0 (off).</dd>
<dt class="dlterm">1</dt>
<dd>The corresponding job switch is to be tested for a 1 (on).</dd>
<dt class="dlterm">X</dt>
<dd>The corresponding job switch is not to be tested. The value in the switch
does not affect the result of %SWITCH.</dd>
</dl>
<p>If <samp class="codeph">%SWITCH(0X111XX0)</samp> is specified, job
switches 1 and 8 are tested for 0s; switches 3, 4, and 5 are tested for 1s;
and switches 2, 6, and 7 are not tested. If each job switch contains the
value (1 or 0 only) shown in the mask, the result of %SWITCH is true '1'.</p>
<p>Switches
can be tested in a CL procedure to control the flow of the procedure. This
function is used in CL procedures with the <span class="cmdname">If (IF)</span> and <span class="cmdname">Change
Variable (CHGVAR)</span> commands. Switches can be changed in a CL procedure
by the <span class="cmdname">Change Job (CHGJOB)</span> command. For CL procedures,
these changes take effect immediately.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="ifcd.htm">%SWITCH with the IF command</a></strong><br />
On the <span class="cmdname">If (IF)</span> command, %SWITCH can be specified
on the COND parameter as the logical expression to be tested.</li>
<li class="ulchildlink"><strong><a href="chgv.htm">%SWITCH with the Change Variable (CHGVAR) command</a></strong><br />
On the <span class="cmdname">Change Variable (CHGVAR)</span> command, you
can specify %SWITCH to change the value of a logical variable. </li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="contp.htm" title="You can use commands to change the flow of logic within your CL procedure.">Control processing within a CL procedure</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="valuv.htm" title="You can change the value of a CL variable using the Change Variable (CHGVAR) command.">Change the value of a variable</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rbam6builtinfunc.htm" title="CL provides several built-in functions.">Built-in functions for CL</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../clfinder/finder.htm">CL command finder</a></div>
<div><a href="../cl/chgjob.htm">Change Job (CHGJOB) command</a></div>
<div><a href="../cl/sbmjob.htm">Submit Job (SBMJOB) command</a></div>
<div><a href="../cl/chgjobd.htm">Change Job Description (CHGJOBD) command</a></div>
<div><a href="../cl/chgvar.htm">Change Variable (CHGVAR) command</a></div>
</div>
</div>
</body>
</html>