ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/cmdc.htm

92 lines
5.2 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?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="Command call" />
<meta name="abstract" content="The CommandCall class allows a Java program to call a non-interactive iSeries command." />
<meta name="description" content="The CommandCall class allows a Java program to call a non-interactive iSeries command." />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="cmdc" />
<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>Command call</title>
</head>
<body id="cmdc"><a name="cmdc"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Command call</h1>
<div><p>The CommandCall class allows a Java™ program to call a non-interactive iSeries™ command.</p>
<div class="section"><p><a href="javadoc/com/ibm/as400/access/CommandCall.html#NAVBAR_TOP"> CommandCall class</a> </p>
<p>Results of the command are
available in a list of <a href="javadoc/com/ibm/as400/access/AS400Message.html#NAVBAR_TOP">AS400Message</a> objects.</p>
<p>Input to CommandCall is
as follows:</p>
<ul><li>The command string to run</li>
<li>The <a href="javadoc/com/ibm/as400/access/AS400.html#NAVBAR_TOP">AS400 object</a> that represents the system that will run
the command</li>
</ul>
<p>The command string can be set on the constructor, through the <a href="javadoc/com/ibm/as400/access/CommandCall.html#SETCOMMAND(JAVA.LANG.STRING)"> setCommand()</a> method, or on the <a href="javadoc/com/ibm/as400/access/CommandCall.html#RUN()">run()</a> method. After the command is run, the Java program
can use the <a href="javadoc/com/ibm/as400/access/CommandCall.html#GETMESSAGELIST()"> getMessageList()</a> method to retrieve any iSeries messages
resulting from the command.</p>
<p>Using the CommandCall class causes the AS400
object to connect to the iSeries. See <a href="mngcon.htm#mngcon">managing
connections</a> for information about managing connections.</p>
<p>When
the Java program
and the iSeries server
command are on the same server, the default IBM<sup>®</sup> Toolbox for Java behavior is to look up the thread safety
for the command on the system. If threadsafe, the command is run on-thread.
You can suppress the run-time lookup by explicitly specifying thread-safety
for the command by using the <a href="javadoc/com/ibm/as400/access/CommandCall.html#SETTHREADSAFE(BOOLEAN)"> setThreadSafe()</a> method.</p>
</div>
<div class="section"><h4 class="sectiontitle">Examples</h4><div class="p">The following examples show ways you can
use the CommandCall class to run different kinds of commands.<div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm#codedisclaimer">Code example disclaimer</a> for
important legal information.</div>
</div>
<p id="cmdc__cmdcex1"><a name="cmdc__cmdcex1"><!-- --></a><strong>Example: Running
a command</strong></p>
<p>The following example shows how to use the CommandCall
class to run a command on an iSeries server:</p>
<pre> // Create an AS400 object.
AS400 sys = new AS400("mySystem.myCompany.com");
// Create a command call object. This
// program sets the command to run
// later. It could set it here on the
// constructor.
CommandCall cmd = new CommandCall(sys);
// Run the CRTLIB command
cmd.run("CRTLIB MYLIB");
// Get the message list which
// contains the result of the
// command.
AS400Message[] messageList = cmd.getMessageList();
// ... process the message list.
// Disconnect since I am done sending
// commands to the server
sys.disconnectService(AS400.COMMAND);</pre>
<p id="cmdc__cmdcexample"><a name="cmdc__cmdcexample"><!-- --></a><strong>Example:
Running a user-specified command</strong></p>
<p><a href="commandcallexample.htm#commandcallexample">Example: Using CommandCall</a> shows
how to run a command that is specified by the user.</p>
</div>
</div>
</body>
</html>