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

118 lines
5.9 KiB
HTML
Raw 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="ProgramCall 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="micropgmcall" />
<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>ProgramCall class</title>
</head>
<body id="micropgmcall"><a name="micropgmcall"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">ProgramCall class</h1>
<div><p></p>
<div class="section"><p>The ProgramCall class in the micro package (<a href="javadoc/com/ibm/as400/micro/ProgramCall.html#NAVBAR_TOP">com.ibm.as400.micro.ProgramCall</a>)
provides a modified subset of the functions available in the <a href="pgmc.htm#pgmc">ProgramCall
class in the access packag</a>e (com.ibm.as400.access.ProgramCall). Use
the ProgramCall class to enable a <a href="microconcept.htm#microconcept__tier0">Tier0
device</a> to call an iSeries™ program and access the data that is returned
after the program runs.</p>
<div class="note"><span class="notetitle">Note:</span> To use ToolboxMe for iSeries classes,
you must separately download and set up the ToolboxME for iSeries component.
For more information, see <a href="microrequire.htm#microrequire">ToolboxME for iSeries requirements</a>.</div>
<p> To
use the <a href="javadoc/com/ibm/as400/micro/ProgramCall.html#RUN(COM.IBM.AS400.MICRO.AS400, JAVA.LANG.STRING, JAVA.LANG.STRING, JAVA.UTIL.HASHTABLE, JAVA.LANG.STRING[])">ProgramCall.run()</a> method, you must provide the following
parameters:</p>
<ul><li>The server on which you want to run the program</li>
<li>The name of the <a href="pcml.htm#pcml">Program Call Markup Language</a> document</li>
<li>The name of the program that you want to run</li>
<li>The hashtable that contains the name of one or more program parameters
that you want to set and the associated values</li>
<li>The string array that contains the name of any parameters to be returned
after the program executes </li>
</ul>
<p>ProgramCall uses PCML to describe the input and output parameters
for the program. The PCML file must be on the same machine as the MEServer,
and you must have an entry for the directory that contains the PCML file
in the CLASSPATH of that machine.</p>
<p>You must register each PCML document
with the MEServer. Registering a PCML document is telling the MEServer which
PCML-defined program you want to run. Register the PCML document either during
runtime or when you start the MEServer.</p>
<p>For more information about
the hashtable that contains program parameters or how to register a PCML
document, see the <a href="javadoc/com/ibm/as400/micro/ProgramCall.html#NAVBAR_TOP_FIRSTROW">ToolboxME for iSeries ProgramCall javadoc</a>. For more information
about PCML, see <a href="pcml.htm#pcml">Program Call Markup Language</a>.</p>
</div>
<div class="section"><h4 class="sectiontitle">Example: Using ProgramCall</h4><p>The following example
shows how to use the ProgramCall class to use your <a href="microconcept.htm#microconcept__tier0">Tier
0 device</a> to run a program on a server:</p>
<pre> // Call programs.
AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer");
String pcmlName = "qsyrusri.pcml"; // The PCML document describing the program we want to use.
String apiName = "qsyrusri";
Hashtable parametersToSet = new Hashtable();
parametersToSet.put("qsyrusri.receiverLength", "2048");
parametersToSet.put("qsyrusri.profileName", "JOHNDOE" };
String[] parametersToGet = { "qsyrusri.receiver.userProfile",
"qsyrusri.receiver.previousSignonDate",
"qsyrusri.receiver.previousSignonTime",
"qsyrusri.receiver.displaySignonInfo" };
String[] valuesToGet = null;
try
{
valuesToGet = ProgramCall.run(system, pcmlName, apiName, parametersToSet, parametersToGet);
// Get and display the user profile.
System.out.println("User profile: " + valuesToGet[0]);
// Get and display the date in a readable format.
char[] c = valuesToGet[1].toCharArray();
System.out.println("Last Signon Date: " + c[3]+c[4]+"/"+c[5]+c[6]+"/"+c[1]+c[2] );
// Get and display the time in a readable format.
char[] d = valuesToGet[2].toCharArray();
System.out.println("Last Signon Time: " + d[0]+d[1]+":"+d[2]+d[3]);
// Get and display the signon info.
System.out.println("Signon Info: " + valuesToGet[3] );
}
catch (MEException te)
{
// Handle the exception.
}
catch (IOException ioe)
{
// Handle the exception
}
// Done with the system object.
system.disconnect();
</pre>
</div>
</div>
</body>
</html>