188 lines
9.9 KiB
HTML
188 lines
9.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="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 <arrayOfStructParm>
|
|
XPCML tag.</p>
|
|
<p>For arrays of structs, XPCML uses the <struct_i> XPCML
|
|
tag to delimit each structParm element. Each <struct_i> tag indicates that
|
|
the data enclosed within it is one element of type autu0150 struct. The index
|
|
attribute of the <struct_i> 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 <i> XPCML tag lists array elements.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">XPCML document qgyolaus.xpcml</h4><pre> <xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="xpcml.xsd" version="4.0">
|
|
|
|
<!-- XPCML source for calling "Open List of Authorized Users" -->
|
|
<!-- (QGYOLAUS) API -->
|
|
|
|
<!-- Format AUTU0150 - Other formats are available -->
|
|
<struct name="autu0150">
|
|
<stringParm name="name" length="10"/>
|
|
<stringParm name="userOrGroup" length="1"/>
|
|
<stringParm name="groupMembers" length="1"/>
|
|
<stringParm name="description" length="50"/>
|
|
</struct>
|
|
|
|
<!-- List information structure (common for "Open List" type APIs) -->
|
|
<struct name="listInfo">
|
|
<intParm name="totalRcds"/>
|
|
<intParm name="rcdsReturned">0</rcdsReturned>
|
|
<hexBinaryParm name="rqsHandle" totalBytes="4"/>
|
|
<intParm name="rcdLength"/>
|
|
<stringParm name="infoComplete" length="1"/>
|
|
<stringParm name="dateCreated" length="7"/>
|
|
<stringParm name="timeCreated" length="6"/>
|
|
<stringParm name="listStatus" length="1"/>
|
|
<hexBinaryParm totalBytes="1"/>
|
|
<unsignedIntParm name="lengthOfInfo"/>
|
|
<intParm name="firstRecord"/>
|
|
<hexBinaryParm totalBytes="40"/>
|
|
</struct>
|
|
|
|
<!-- Program QGYOLAUS and its parameter list for retrieving -->
|
|
<!-- AUTU0150 format -->
|
|
|
|
<program name="QGYOLAUS" path="/QSYS.lib/QGY.lib/QGYOLAUS.pgm"
|
|
parseOrder="listInfo receiver">
|
|
<parameterList>
|
|
// Output values --- array of the autu0150 struct
|
|
<arrayOfStructParm name="receiver" count="listInfo.rcdsReturned"
|
|
passDirection="out" outputSize="receiverLength" struct="autu0150"/>
|
|
// Input values
|
|
<intParm name="receiverLength" passDirection="in">16384</intParm>
|
|
<structParm name="listInfo" passDirection="out" struct="listInfo"/>
|
|
// Input values
|
|
<intParm name="rcdsToReturn" passDirection="in">264</intParm>
|
|
<stringParm name="format" passDirection="in" length="10">
|
|
AUTU0150</stringParm>
|
|
<stringParm name="selection" passDirection="in" length="10">
|
|
*USER</stringParm>
|
|
<stringParm name="member" passDirection="in" length="10">
|
|
*NONE</stringParm>
|
|
<intParm name="errorCode" passDirection="in">0</intParm>
|
|
</parameterList>
|
|
</program></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> <?xml version="1.0" ?>
|
|
<xpcml version="4.0"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation='xpcml.xsd' >
|
|
|
|
<program name="QGYOLAUS" path="/QSYS.lib/QGY.lib/QGYOLAUS.pgm"
|
|
parseOrder="listInfo receiver">
|
|
<parameterList>
|
|
<arrayOfStructParm name="receiver" passDirection="out"
|
|
count="listInfo.rcdsReturned" outputSize="receiverLength"
|
|
struct="autu0150">
|
|
<struct_i index="0">
|
|
<stringParm name="name" length="10">JANEDOW</stringParm>
|
|
<stringParm name="userOrGroup" length="1">0</stringParm>
|
|
<stringParm name="groupMembers" length="1">0</stringParm>
|
|
<stringParm name="description" length="50">
|
|
Jane Doe</stringParm>
|
|
</struct_i>
|
|
<struct_i index="1">
|
|
<stringParm name="name" length="10">BOBS</stringParm>
|
|
<stringParm name="userOrGroup" length="1">0</stringParm>
|
|
<stringParm name="groupMembers" length="1">0</stringParm>
|
|
<stringParm name="description" length="50">
|
|
Bob Smith</stringParm>
|
|
</struct_i>
|
|
|
|
<!-- More records here depending on how many users output. -->
|
|
<!-- In this case 89 user records are listed here. -->
|
|
|
|
</arrayOfStructParm> <!-- End of user array -->
|
|
<intParm name="receiverLength" passDirection="in">
|
|
16384</intParm>
|
|
<structParm name="listInfo" passDirection="out"
|
|
struct="listInfo">
|
|
<intParm name="totalRcds">89</intParm>
|
|
<intParm name="rcdsReturned">89</intParm>
|
|
<hexBinaryParm name="rqsHandle" totalBytes="4">
|
|
00000001==</hexBinaryParm>
|
|
<intParm name="rcdLength">62</intParm>
|
|
<stringParm name="infoComplete" length="1">C</stringParm>
|
|
<stringParm name="dateCreated" length="7">
|
|
1030321</stringParm>
|
|
<stringParm name="timeCreated" length="6">
|
|
120927</stringParm>
|
|
<stringParm name="listStatus" length="1">2</stringParm>
|
|
<hexBinaryParm totalBytes="1"></hexBinaryParm>
|
|
<unsignedIntParm name="lengthOfInfo">
|
|
5518</unsignedIntParm>
|
|
<intParm name="firstRecord">1</intParm>
|
|
</structParm>
|
|
<intParm name="rcdsToReturn" passDirection="in">264</intParm>
|
|
<stringParm name="format" passDirection="in" length="10">
|
|
AUTU0150</stringParm>
|
|
<stringParm name="selection" passDirection="in" length="10">
|
|
*USER</stringParm>
|
|
<stringParm name="member" passDirection="in" length="10">
|
|
*NONE</stringParm>
|
|
<intParm name="errorCode" passDirection="in">0</intParm>
|
|
</parameterList>
|
|
</program>
|
|
</xpcml></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |