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

188 lines
9.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="Example: Retrieving program call results as XPCML" />
<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="rzahhxpcmlexmplregobtain" />
<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>Example: Retrieving program call results as XPCML </title>
</head>
<body id="rzahhxpcmlexmplregobtain"><a name="rzahhxpcmlexmplregobtain"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Retrieving program call results as XPCML </h1>
<div><div class="section"><p>The following example shows how you can construct an XPCML ProgramCallDocument,
call an iSeries™ program,
and retrieve the results of the program call as XPCML. The example supposes
the following components:</p>
<ul><li>XPCML document qgyolaus.xpcml, which defines the program and parameter
specifications with input values</li>
<li>Java™ code
that constructs a ProgramCallDocument object, uses the XPCML file, and then
calls program QGYOLAUS</li>
<li>Results of the program call, which the Java code generates as XPCML and stores
in file XPCMLOut.xpcml</li>
</ul>
<p>Notice how array data is specified in the original and the generated
XPCML. The element qgyolaus.receiver, an output parameter, is an XPCML arrayOfStructParm
with an attribute that sets the count to listInfo.rcdsReturned. The following
example code includes only part of the QGYOLAUS output. If the example included
all the output, the code might list 89 users under the &lt;arrayOfStructParm&gt;
XPCML tag.</p>
<p>For arrays of structs, XPCML uses the &lt;struct_i&gt; XPCML
tag to delimit each structParm element. Each &lt;struct_i&gt; tag indicates that
the data enclosed within it is one element of type autu0150 struct. The index
attribute of the &lt;struct_i&gt; tag specifies the element of the array for
the struct.</p>
<p>For arrays of simple types, such as arrayOfStringParm, arrayOfIntParm,
and so on, the &lt;i&gt; XPCML tag lists array elements.</p>
</div>
<div class="section"><h4 class="sectiontitle">XPCML document qgyolaus.xpcml</h4><pre> &lt;xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xpcml.xsd" version="4.0"&gt;
&lt;!-- XPCML source for calling "Open List of Authorized Users" --&gt;
&lt;!-- (QGYOLAUS) API --&gt;
&lt;!-- Format AUTU0150 - Other formats are available --&gt;
&lt;struct name="autu0150"&gt;
&lt;stringParm name="name" length="10"/&gt;
&lt;stringParm name="userOrGroup" length="1"/&gt;
&lt;stringParm name="groupMembers" length="1"/&gt;
&lt;stringParm name="description" length="50"/&gt;
&lt;/struct&gt;
&lt;!-- List information structure (common for "Open List" type APIs) --&gt;
&lt;struct name="listInfo"&gt;
&lt;intParm name="totalRcds"/&gt;
&lt;intParm name="rcdsReturned"&gt;0&lt;/rcdsReturned&gt;
&lt;hexBinaryParm name="rqsHandle" totalBytes="4"/&gt;
&lt;intParm name="rcdLength"/&gt;
&lt;stringParm name="infoComplete" length="1"/&gt;
&lt;stringParm name="dateCreated" length="7"/&gt;
&lt;stringParm name="timeCreated" length="6"/&gt;
&lt;stringParm name="listStatus" length="1"/&gt;
&lt;hexBinaryParm totalBytes="1"/&gt;
&lt;unsignedIntParm name="lengthOfInfo"/&gt;
&lt;intParm name="firstRecord"/&gt;
&lt;hexBinaryParm totalBytes="40"/&gt;
&lt;/struct&gt;
&lt;!-- Program QGYOLAUS and its parameter list for retrieving --&gt;
&lt;!-- AUTU0150 format --&gt;
&lt;program name="QGYOLAUS" path="/QSYS.lib/QGY.lib/QGYOLAUS.pgm"
parseOrder="listInfo receiver"&gt;
&lt;parameterList&gt;
// Output values --- array of the autu0150 struct
&lt;arrayOfStructParm name="receiver" count="listInfo.rcdsReturned"
passDirection="out" outputSize="receiverLength" struct="autu0150"/&gt;
// Input values
&lt;intParm name="receiverLength" passDirection="in"&gt;16384&lt;/intParm&gt;
&lt;structParm name="listInfo" passDirection="out" struct="listInfo"/&gt;
// Input values
&lt;intParm name="rcdsToReturn" passDirection="in"&gt;264&lt;/intParm&gt;
&lt;stringParm name="format" passDirection="in" length="10"&gt;
AUTU0150&lt;/stringParm&gt;
&lt;stringParm name="selection" passDirection="in" length="10"&gt;
*USER&lt;/stringParm&gt;
&lt;stringParm name="member" passDirection="in" length="10"&gt;
*NONE&lt;/stringParm&gt;
&lt;intParm name="errorCode" passDirection="in"&gt;0&lt;/intParm&gt;
&lt;/parameterList&gt;
&lt;/program&gt;</pre>
</div>
<div class="section"><h4 class="sectiontitle">Java code that constructs the ProgramCallDocument object
and uses the XPCML to call program QGYOLAUS</h4><pre> system = new AS400();
// Create a ProgramCallDocument into which to parse the file.
ProgramCallDocument xpcmlDoc =
new ProgramCallDocument(system, "QGYOLAUS.xpcml");
// Call QGYOLAUS
boolean rc = xpcmlDoc.callProgram("QGYOLAUS");
// Obtain program call results as XPCML and store them
// in file XPCMLOut.xpcml
if (rc) // Program was successful
xpcmlDoc.generateXPCML("QGYOLAUS","XPCMLOut.xpcml");</pre>
</div>
<div class="section"><h4 class="sectiontitle">Results of the program call, generated as XPCML and stored
in file XPCMLOut.xpcml</h4><pre> &lt;?xml version="1.0" ?&gt;
&lt;xpcml version="4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='xpcml.xsd' &gt;
&lt;program name="QGYOLAUS" path="/QSYS.lib/QGY.lib/QGYOLAUS.pgm"
parseOrder="listInfo receiver"&gt;
&lt;parameterList&gt;
&lt;arrayOfStructParm name="receiver" passDirection="out"
count="listInfo.rcdsReturned" outputSize="receiverLength"
struct="autu0150"&gt;
&lt;struct_i index="0"&gt;
&lt;stringParm name="name" length="10"&gt;JANEDOW&lt;/stringParm&gt;
&lt;stringParm name="userOrGroup" length="1"&gt;0&lt;/stringParm&gt;
&lt;stringParm name="groupMembers" length="1"&gt;0&lt;/stringParm&gt;
&lt;stringParm name="description" length="50"&gt;
Jane Doe&lt;/stringParm&gt;
&lt;/struct_i&gt;
&lt;struct_i index="1"&gt;
&lt;stringParm name="name" length="10"&gt;BOBS&lt;/stringParm&gt;
&lt;stringParm name="userOrGroup" length="1"&gt;0&lt;/stringParm&gt;
&lt;stringParm name="groupMembers" length="1"&gt;0&lt;/stringParm&gt;
&lt;stringParm name="description" length="50"&gt;
Bob Smith&lt;/stringParm&gt;
&lt;/struct_i&gt;
&lt;!-- More records here depending on how many users output. --&gt;
&lt;!-- In this case 89 user records are listed here. --&gt;
&lt;/arrayOfStructParm&gt; &lt;!-- End of user array --&gt;
&lt;intParm name="receiverLength" passDirection="in"&gt;
16384&lt;/intParm&gt;
&lt;structParm name="listInfo" passDirection="out"
struct="listInfo"&gt;
&lt;intParm name="totalRcds"&gt;89&lt;/intParm&gt;
&lt;intParm name="rcdsReturned"&gt;89&lt;/intParm&gt;
&lt;hexBinaryParm name="rqsHandle" totalBytes="4"&gt;
00000001==&lt;/hexBinaryParm&gt;
&lt;intParm name="rcdLength"&gt;62&lt;/intParm&gt;
&lt;stringParm name="infoComplete" length="1"&gt;C&lt;/stringParm&gt;
&lt;stringParm name="dateCreated" length="7"&gt;
1030321&lt;/stringParm&gt;
&lt;stringParm name="timeCreated" length="6"&gt;
120927&lt;/stringParm&gt;
&lt;stringParm name="listStatus" length="1"&gt;2&lt;/stringParm&gt;
&lt;hexBinaryParm totalBytes="1"&gt;&lt;/hexBinaryParm&gt;
&lt;unsignedIntParm name="lengthOfInfo"&gt;
5518&lt;/unsignedIntParm&gt;
&lt;intParm name="firstRecord"&gt;1&lt;/intParm&gt;
&lt;/structParm&gt;
&lt;intParm name="rcdsToReturn" passDirection="in"&gt;264&lt;/intParm&gt;
&lt;stringParm name="format" passDirection="in" length="10"&gt;
AUTU0150&lt;/stringParm&gt;
&lt;stringParm name="selection" passDirection="in" length="10"&gt;
*USER&lt;/stringParm&gt;
&lt;stringParm name="member" passDirection="in" length="10"&gt;
*NONE&lt;/stringParm&gt;
&lt;intParm name="errorCode" passDirection="in"&gt;0&lt;/intParm&gt;
&lt;/parameterList&gt;
&lt;/program&gt;
&lt;/xpcml&gt;</pre>
</div>
</div>
</body>
</html>