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

77 lines
3.6 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="CommandCall class" />
<meta name="abstract" content="" />
<meta name="description" content="" />
<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="microcmdcall" />
<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>CommandCall class</title>
</head>
<body id="microcmdcall"><a name="microcmdcall"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">CommandCall class</h1>
<div><p></p>
<div class="section"><p>The CommandCall class in the micro package (<a href="javadoc/com/ibm/as400/micro/CommandCall.html#NAVBAR_TOP">com.ibm.as400.micro.CommandCall</a>)
provides a modified subset of the functions available in the <a href="cmdc.htm#cmdc">CommandCall
class in the access package</a> (com.ibm.as400.access.CommandCall). Use
the CommandCall class to call an iSeries™ command from a <a href="microconcept.htm#microconcept__tier0">Tier0</a>
device.</p>
<div class="note"><span class="notetitle">Note:</span> To use ToolboxMe for iSeries classes, you must separately
<a href="microsetup.htm#microsetup">download and set up the ToolboxME
for iSeries component</a>.</div>
<p>The
CommandCall <a href="javadoc/com/ibm/as400/micro/CommandCall.html#RUN(COM.IBM.AS400.MICRO.AS400, JAVA.LANG.STRING)">run() method</a> requires a String (the command you want
to run) and returns any messages resulting from running the command as a
String. If the command completes but does not generate any messages, the
run() method returns an empty String array.</p>
</div>
<div class="section"><h4 class="sectiontitle">Example: Using CommandCall</h4><p>The following example
demonstrates how you can use CommandCall:</p>
<pre> // Work with commands.
AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer");
try
{
// Run the command "CRTLIB FRED."
String[] messages = CommandCall.run(system, "CRTLIB FRED");
if (messages != null)
{
// Note that there was an error.
System.out.println("Command failed:");
for (int i = 0; i &lt; messages.length; ++i)
{
System.out.println(messages[i]);
}
}
else
{
System.out.println("Command succeeded!");
}
}
catch (Exception e)
{
// Handle the exception
}
// Done with the system object.
system.disconnect();</pre>
</div>
</div>
</body>
</html>