<?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: Condensing an existing XPCML document, including Java code" />
<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="rzahhxpcmlexmplconcondense01" />
<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: Condensing an existing XPCML document, including Java code</title>
</head>
<body id="rzahhxpcmlexmplconcondense01"><a name="rzahhxpcmlexmplconcondense01"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Condensing an existing XPCML document, including Java code</h1>
<div><div class="section"><p>The following example illustrates how to condense an existing
XPCML document. The example includes original XPCML source, the resulting
condensed XPCML, the Java™ code that calls condenseXPCML(), and
a few of the newly generated type definitions in the extended schema:</p>
</div>
<div class="section"><h4 class="sectiontitle">Original XPCML source</h4><pre>     &lt;!-- Fully specified XPCML source --&gt;
     &lt;xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:noNamespaceSchemaLocation="xpcml.xsd" version="4.0"&gt;

     &lt;struct name="qualifiedJobName"&gt;
        &lt;stringParm name="jobName" length="10"&gt;*&lt;/stringParm&gt;
        &lt;stringParm name="userName" length="10"/&gt;
        &lt;stringParm name="jobNumber" length="6"/&gt;
     &lt;/struct&gt;

     &lt;struct name="jobi0100"&gt;
        &lt;intParm name="numberOfBytesReturned"/&gt;
        &lt;intParm name="numberOfBytesAvailable"/&gt;
        &lt;structParm name="qualifiedJobName" struct="qualifiedJobName"/&gt;
        &lt;hexBinaryParm name="internalJobIdentifier" totalBytes="16"/&gt;
        &lt;stringParm name="jobStatus" length="10"/&gt;  
        &lt;stringParm name="jobType" length="1"/&gt;  
        &lt;stringParm name="jobSubtype" length="1"/&gt;  
        &lt;stringParm length="2"/&gt;  
        &lt;intParm name="runPriority"/&gt;
        &lt;intParm name="timeSlice"/&gt;
        &lt;intParm name="defaultWait"/&gt;
        &lt;stringParm name="purge" length="10"/&gt;  
     &lt;/struct&gt;        

     &lt;program name="qusrjobi_jobi0100" path="/QSYS.LIB/QUSRJOBI.PGM"&gt; 
        &lt;parameterList&gt;        
           &lt;structParm name="receiverVariable" passDirection="out"
              outputSize="lengthOfReceiverVariable" struct="jobi0100"/&gt;
           &lt;intParm name="lengthOfReceiverVariable" passDirection="in"&gt;86&lt;/intParm&gt;
           &lt;stringParm name="formatName" passDirection="in" length="8"&gt;JOBI0100&lt;/stringParm&gt;
           &lt;structParm name="qualifiedJobName" passDirection="in" struct="qualifiedJobName"/&gt;
           &lt;hexBinaryParm name="internalJobIdentifier"
              passDirection="in" totalBytes="16"&gt; &lt;/hexBinaryParm&gt;
           &lt;intParm name="errorCode" passDirection="in"&gt;0&lt;/intParm&gt;
        &lt;/parameterList&gt; 
     &lt;/program&gt;
     &lt;/xpcml&gt;</pre>
</div>
<div class="section"><h4 class="sectiontitle">Java code to condense the original XPCML source</h4><pre>     try {
        FileInputStream fullStream = new FileInputStream("myXPCML.xpcml");
        FileOutputStream condensedStream = new FileOutputStream("myCondensedXPCML.xpcml");
        FileOutputStream xsdStream = new FileOutputStream("myXSD.xsd");
        ProgramCallDocument.condenseXPCML(fullStream, xsdStream, condensedStream, "myXSD.xsd");

     }
     catch (Exception e) {
       System.out.println("error:  - "+e.getMessage());
       e.printStackTrace();
     }</pre>
</div>
<div class="section"><h4 class="sectiontitle">Condensed XPCML source: myCondensedXPCML.xpcml</h4><pre>     &lt;xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xsi:noNamespaceSchemaLocation="myXSD.xsd" version="4.0"&gt;

     &lt;struct name="qualifiedJobName"&gt;
        &lt;jobName_&gt;*&lt;/jobName_&gt;
        &lt;userName_/&gt;
        &lt;jobNumber_/&gt;
     &lt;/struct&gt;

     &lt;struct name="jobi0100"&gt;
        &lt;numberOfBytesReturned_/&gt;
        &lt;numberOfBytesAvailable_/&gt;
        &lt;structParm name="qualifiedJobName" struct="qualifiedJobName"/&gt;
        &lt;internalJobIdentifier_/&gt;  
        &lt;jobStatus_/&gt;  
        &lt;jobType_/&gt;  
        &lt;jobSubtype_/&gt;  
        &lt;stringParm length="2"/&gt;  
        &lt;runPriority_/&gt;
        &lt;timeSlice_/&gt;
        &lt;defaultWait_/&gt;
        &lt;purge_/&gt;  
     &lt;/struct&gt;        

     &lt;program name="qusrjobi_jobi0100" path="/QSYS.LIB/QUSRJOBI.PGM"&gt; 
        &lt;parameterList&gt;        
           &lt;structParm name="receiverVariable" passDirection="out"
              outputSize="lengthOfReceiverVariable" struct="jobi0100"/&gt;
           &lt;lengthOfReceiverVariable_&gt;86&lt;/lengthOfReceiverVariable_&gt;
           &lt;formatName_&gt;JOBI0100&lt;/formatName_&gt;
           &lt;structParm name="qualifiedJobName" passDirection="in" struct="qualifiedJobName"/&gt;
           &lt;internalJobIdentifier_&gt; &lt;/internalJobIdentifier_&gt; 
           &lt;errorCode_&gt;0&lt;/errorCode_&gt;                    
        &lt;/parameterList&gt; 
     &lt;/program&gt;
     &lt;/xpcml&gt;</pre>
</div>
<div class="section"><h4 class="sectiontitle">Some type definitions from the generated schema: myXSD.xsd</h4><pre>     &lt;xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'&gt;
     &lt;xs:include schemaLocation='xpcml.xsd'/&gt;

     &lt;xs:element name="jobName_" substitutionGroup="stringParmGroup" &gt;
        &lt;xs:complexType&gt;
           &lt;xs:simpleContent&gt;
           &lt;xs:restriction base="stringParmType"&gt;
              &lt;xs:attribute name="name" type="string50" fixed="jobName" /&gt;
              &lt;xs:attribute name="length" type="xs:string" fixed="10" /&gt;
           &lt;/xs:restriction&gt;
           &lt;/xs:simpleContent&gt;
        &lt;/xs:complexType&gt;
     &lt;/xs:element&gt;

     &lt;xs:element name="userName_" substitutionGroup="stringParmGroup" &gt;
        &lt;xs:complexType&gt;
           &lt;xs:simpleContent&gt;
           &lt;xs:restriction base="stringParmType"&gt;
              &lt;xs:attribute name="name" type="string50" fixed="userName" /&gt;
              &lt;xs:attribute name="length" type="xs:string" fixed="10" /&gt;
           &lt;/xs:restriction&gt;
           &lt;/xs:simpleContent&gt;
        &lt;/xs:complexType&gt;
     &lt;/xs:element&gt;

     &lt;xs:element name="jobNumber_" substitutionGroup="stringParmGroup" &gt;
        &lt;xs:complexType&gt;
           &lt;xs:simpleContent&gt;
           &lt;xs:restriction base="stringParmType"&gt;
              &lt;xs:attribute name="name" type="string50" fixed="jobNumber" /&gt;
              &lt;xs:attribute name="length" type="xs:string" fixed="6" /&gt;
           &lt;/xs:restriction&gt;
           &lt;/xs:simpleContent&gt;
        &lt;/xs:complexType&gt;
     &lt;/xs:element&gt;

     &lt;xs:element name="lengthOfReceiverVariable_" substitutionGroup="intParmGroup" &gt;
        &lt;xs:complexType&gt;
           &lt;xs:simpleContent&gt;
           &lt;xs:restriction base="intParmType"&gt;
              &lt;xs:attribute name="name" type="string50" fixed="lengthOfReceiverVariable" /&gt;
              &lt;xs:attribute name="passDirection" type="passDirectionType" fixed="in" /&gt;
           &lt;/xs:restriction&gt;
           &lt;/xs:simpleContent&gt;
        &lt;/xs:complexType&gt;
     &lt;/xs:element&gt;

     &lt;xs:element name="formatName_" substitutionGroup="stringParmGroup" &gt;
        &lt;xs:complexType&gt;
           &lt;xs:simpleContent&gt;
           &lt;xs:restriction base="stringParmType"&gt;
              &lt;xs:attribute name="name" type="string50" fixed="formatName" /&gt;
              &lt;xs:attribute name="length" type="xs:string" fixed="8" /&gt;
              &lt;xs:attribute name="passDirection" type="passDirectionType" fixed="in" /&gt;
           &lt;/xs:restriction&gt;
           &lt;/xs:simpleContent&gt;
        &lt;/xs:complexType&gt;
     &lt;/xs:element&gt;

     &lt;!-- More type definitions for each newly defined type follow here --&gt;
     &lt;/xs:schema&gt;</pre>
</div>
</div>

</body>
</html>