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

255 lines
13 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 multidimensional data" />
<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="pcmlmddt" />
<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 multidimensional data</title>
</head>
<body id="pcmlmddt"><a name="pcmlmddt"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Retrieving multidimensional data</h1>
<div><p></p>
<div class="section"><p>This example has two parts:</p>
<ul><li> <a href="#pcmlmddt__pcmlqznfrtve">PCML source for calling QZNFRTVE</a></li>
<li> <a href="#pcmlmddt__javaqznfrtve">Java™ program source for calling QZNFRTVE</a></li>
</ul>
</div>
<div class="section" id="pcmlmddt__pcmlqznfrtve"><a name="pcmlmddt__pcmlqznfrtve"><!-- --></a><h4 class="sectiontitle">PCML source for calling QZNFRTVE</h4><pre>&lt;pcml version="1.0"&gt;
&lt;struct name="receiver"&gt;
&lt;data name="lengthOfEntry" type="int" length="4" /&gt;
&lt;data name="dispToObjectPathName" type="int" length="4" /&gt;
&lt;data name="lengthOfObjectPathName" type="int" length="4" /&gt;
&lt;data name="ccsidOfObjectPathName" type="int" length="4" /&gt;
&lt;data name="readOnlyFlag" type="int" length="4" /&gt;
&lt;data name="nosuidFlag" type="int" length="4" /&gt;
&lt;data name="dispToReadWriteHostNames" type="int" length="4" /&gt;
&lt;data name="nbrOfReadWriteHostNames" type="int" length="4" /&gt;
&lt;data name="dispToRootHostNames" type="int" length="4" /&gt;
&lt;data name="nbrOfRootHostNames" type="int" length="4" /&gt;
&lt;data name="dispToAccessHostNames" type="int" length="4" /&gt;
&lt;data name="nbrOfAccessHostNames" type="int" length="4" /&gt;
&lt;data name="dispToHostOptions" type="int" length="4" /&gt;
&lt;data name="nbrOfHostOptions" type="int" length="4" /&gt;
&lt;data name="anonUserID" type="int" length="4" /&gt;
&lt;data name="anonUsrPrf" type="char" length="10" /&gt;
&lt;data name="pathName" type="char" length="lengthOfObjectPathName"
offset="dispToObjectPathName" offsetfrom="receiver" /&gt;
&lt;struct name="rwAccessList" count="nbrOfReadWriteHostNames"
offset="dispToReadWriteHostNames" offsetfrom="receiver"&gt;
&lt;data name="lengthOfEntry" type="int" length="4" /&gt;
&lt;data name="lengthOfHostName" type="int" length="4" /&gt;
&lt;data name="hostName" type="char" length="lengthOfHostName" /&gt;
&lt;data type="byte" length="0"
offset="lengthOfEntry" /&gt;
&lt;/struct&gt;
&lt;struct name="rootAccessList" count="nbrOfRootHostNames"
offset="dispToRootHostNames" offsetfrom="receiver"&gt;
&lt;data name="lengthOfEntry" type="int" length="4" /&gt;
&lt;data name="lengthOfHostName" type="int" length="4" /&gt;
&lt;data name="hostName" type="char" length="lengthOfHostName" /&gt;
&lt;data type="byte" length="0"
offset="lengthOfEntry" /&gt;
&lt;/struct&gt;
&lt;struct name="accessHostNames" count="nbrOfAccessHostNames"
offset="dispToAccessHostNames" offsetfrom="receiver" &gt;
&lt;data name="lengthOfEntry" type="int" length="4" /&gt;
&lt;data name="lengthOfHostName" type="int" length="4" /&gt;
&lt;data name="hostName" type="char" length="lengthOfHostName" /&gt;
&lt;data type="byte" length="0"
offset="lengthOfEntry" /&gt;
&lt;/struct&gt;
&lt;struct name="hostOptions" offset="dispToHostOptions" offsetfrom="receiver" count="nbrOfHostOptions"&gt;
&lt;data name="lengthOfEntry" type="int" length="4" /&gt;
&lt;data name="dataFileCodepage" type="int" length="4" /&gt;
&lt;data name="pathNameCodepage" type="int" length="4" /&gt;
&lt;data name="writeModeFlag" type="int" length="4" /&gt;
&lt;data name="lengthOfHostName" type="int" length="4" /&gt;
&lt;data name="hostName" type="char" length="lengthOfHostName" /&gt;
&lt;data type="byte" length="0" offset="lengthOfEntry" /&gt;
&lt;/struct&gt;
&lt;data type="byte" length="0" offset="lengthOfEntry" /&gt;
&lt;/struct&gt;
&lt;struct name="returnedRcdsFdbkInfo"&gt;
&lt;data name="bytesReturned" type="int" length="4" /&gt;
&lt;data name="bytesAvailable" type="int" length="4" /&gt;
&lt;data name="nbrOfNFSExportEntries" type="int" length="4" /&gt;
&lt;data name="handle" type="int" length="4" /&gt;
&lt;/struct&gt;
&lt;program name="qznfrtve" path="/QSYS.lib/QZNFRTVE.pgm" parseorder="returnedRcdsFdbkInfo receiver" &gt;
&lt;data name="receiver" type="struct" struct="receiver" usage="output"
count="returnedRcdsFdbkInfo.nbrOfNFSExportEntries" outputsize="receiverLength"/&gt;
&lt;data name="receiverLength" type="int" length="4" usage="input" init="4096" /&gt;
&lt;data name="returnedRcdsFdbkInfo" type="struct" struct="returnedRcdsFdbkInfo" usage="output" /&gt;
&lt;data name="formatName" type="char" length="8" usage="input" init="EXPE0100" /&gt;
&lt;data name="objectPathName" type="char" length="lengthObjPathName" usage="input" init="*FIRST" /&gt;
&lt;data name="lengthObjPathName" type="int" length="4" usage="input" init="6" /&gt;
&lt;data name="ccsidObjectPathName" type="int" length="4" usage="input" init="0" /&gt;
&lt;data name="desiredCCSID" type="int" length="4" usage="input" init="0" /&gt;
&lt;data name="handle" type="int" length="4" usage="input" init="0" /&gt;
&lt;data name="errorCode" type="int" length="4" usage="input" init="0" /&gt;
&lt;/program&gt;
&lt;/pcml&gt;</pre>
</div>
<div class="section" id="pcmlmddt__javaqznfrtve"><a name="pcmlmddt__javaqznfrtve"><!-- --></a><h4 class="sectiontitle">Java program source for calling QZNFRTVE</h4><pre>import com.ibm.as400.data.ProgramCallDocument;
import com.ibm.as400.data.PcmlException;
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400Message;
// Example program to call "Retrieve NFS Exports" (QZNFRTVE) API
public class qznfrtve
{
public static void main(String[] argv)
{
AS400 as400System; // com.ibm.as400.access.AS400
ProgramCallDocument pcml; // com.ibm.as400.data.ProgramCallDocument
boolean rc = false; // Return code from ProgramCallDocument.callProgram()
String msgId, msgText; // Messages returned from the server
Object value; // Return value from ProgramCallDocument.getValue()
System.setErr(System.out);
// Construct AS400 without parameters, user will be prompted
as400System = new AS400();
int[] indices = new int[2]; // Indices for access array value
int nbrExports; // Number of exports returned
int nbrOfReadWriteHostNames, nbrOfRWHostNames, nbrOfRootHostNames,
nbrOfAccessHostnames, nbrOfHostOpts;
try
{
// Uncomment the following to get debugging information
// com.ibm.as400.data.PcmlMessageLog.setTraceEnabled(true);
System.out.println("Beginning PCML Example..");
System.out.println(" Constructing ProgramCallDocument for QZNFRTVE API...");
// Construct ProgramCallDocument
// First parameter is system to connect to
// Second parameter is pcml resource name. In this example,
// serialized PCML file "qznfrtve.pcml.ser" or
// PCML source file "qznfrtve.pcml" must be found in the classpath.
pcml = new ProgramCallDocument(as400System, "qznfrtve");
// Set input parameters. Several parameters have default values
// specified in the PCML source. Do not need to set them using Java code.
System.out.println(" Setting input parameters...");
pcml.setValue("qznfrtve.receiverLength", new Integer( ( pcml.getOutputsize("qznfrtve.receiver"))));
// Request to call the API
// User will be prompted to sign on to the system
System.out.println(" Calling QZNFRTVE API requesting NFS exports.");
rc = pcml.callProgram("qznfrtve");
if (rc == false)
{
// Retrieve list of server messages
AS400Message[] msgs = pcml.getMessageList("qznfrtve");
// Iterate through messages and write them to standard output
for (int m = 0; m &lt; msgs.length; m++)
{
msgId = msgs[m].getID();
msgText = msgs[m].getText();
System.out.println(" " + msgId + " - " + msgText);
}
System.out.println("** Call to QZNFRTVE failed. See messages above **");
System.exit(0);
}
// Return code was true, call to QZNFRTVE succeeded
// Write some of the results to standard output
else
{
nbrExports = pcml.getIntValue("qznfrtve.returnedRcdsFdbkInfo.nbrOfNFSExportEntries");
// Iterate through list of exports
for (indices[0] = 0; indices[0] &lt; nbrExports; indices[0]++)
{
value = pcml.getValue("qznfrtve.receiver.pathName", indices);
System.out.println("Path name = " + value);
// Iterate and write out Read Write Host Names for this export
nbrOfReadWriteHostNames = pcml.getIntValue("qznfrtve.receiver.nbrOfReadWriteHostNames",
indices);
for(indices[1] = 0; indices[1] &lt; nbrOfReadWriteHostNames; indices[1]++)
{
value = pcml.getValue("qznfrtve.receiver.rwAccessList.hostName", indices);
System.out.println(" Read/write access host name = " + value);
}
// Iterate and write out Root Host Names for this export
nbrOfRootHostNames = pcml.getIntValue("qznfrtve.receiver.nbrOfRootHostNames", indices);
for(indices[1] = 0; indices[1] &lt; nbrOfRootHostNames; indices[1]++)
{
value = pcml.getValue("qznfrtve.receiver.rootAccessList.hostName", indices);
System.out.println(" Root access host name = " + value);
}
// Iterate and write out Access Host Names for this export
nbrOfAccessHostnames = pcml.getIntValue("qznfrtve.receiver.nbrOfAccessHostNames",
indices);
for(indices[1] = 0; indices[1] &lt; nbrOfAccessHostnames; indices[1]++)
{
value = pcml.getValue("qznfrtve.receiver.accessHostNames.hostName", indices);
System.out.println(" Access host name = " + value);
}
// Iterate and write out Host Options for this export
nbrOfHostOpts = pcml.getIntValue("qznfrtve.receiver.nbrOfHostOptions", indices);
for(indices[1] = 0; indices[1] &lt; nbrOfHostOpts; indices[1]++)
{
System.out.println(" Host options:");
value = pcml.getValue("qznfrtve.receiver.hostOptions.dataFileCodepage", indices);
System.out.println(" Data file code page = " + value);
value = pcml.getValue("qznfrtve.receiver.hostOptions.pathNameCodepage", indices);
System.out.println(" Path name code page = " + value);
value = pcml.getValue("qznfrtve.receiver.hostOptions.writeModeFlag", indices);
System.out.println(" Write mode flag = " + value);
value = pcml.getValue("qznfrtve.receiver.hostOptions.hostName", indices);
System.out.println(" Host name = " + value);
}
} // end for loop iterating list of exports
} // end call to QZNFRTVE succeeded
}
catch(PcmlException e)
{
System.out.println(e.getLocalizedMessage());
e.printStackTrace();
System.exit(-1);
}
System.exit(0);
} // end main()
}</pre>
</div>
</div>
</body>
</html>