You use the same process to obtain the results of a program call as condensed XPCML or noncondensed XPCML. All you need to do is call ProgramCallDocument.generateXPCML().
Use setXsdName() to specify the name of the extended schema, which generateXPCML() uses to generate the noNamespaceSchemaLocation attribute of the <xpcml> tag in the condensed XPCML.
Using setXsdName() is important when you want to use the program call results (in condensed XPCML) as source for another ProgramCallDocument object. You must specify the name of the extended schema so that the parser knows which schema file to use when parsing.
For example, the following code obtains the results from a program call and generates condensed XPCML.
AS400 system = new AS400(); // Create a ProgramCallDocument and parse the file. ProgramCallDocument xpcmlDoc = new ProgramCallDocument(system, "myCondensedXPCML.xpcml", new FileInputStream("myXSD.xsd")); boolean rc = xpcmlDoc.callProgram("qusrjobi_jobi0100"); if (rc) // Program was successful { xpcmlDoc.setXsdName("myXSD.xsd"); xpcmlDoc.generateXPCML("qusrjobi_jobi0100","XPCMLOut.xpcml"); }
The following code shows an example of obtaining program call results as condensed XPCML:
<xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="myXSD.xsd" version="4.0"> <program name="qusrjobi_jobi0100" path="/QSYS.LIB/QUSRJOBI.PGM"> <parameterList> <structParm name="receiverVariable" passDirection="out" outputSize="lengthOfReceiverVariable" struct="jobi0100"/> <numberOfBytesReturned_>100</numberOfBytesReturned_> <numberOfBytesAvailable_>100</numberOfBytesAvailable_> <structParm name="qualifiedJobName" struct="qualifiedJobName"> <jobName_>*</jobName_> <userName_/> <jobNumber_/> </structParm> <internalJobIdentifier_/> <jobStatus_>ACTIVE</jobStatus_> <jobType_>PJ</jobType> <jobSubtype_/> <stringParm length="2"/> <runPriority_>5</runPriority> <timeSlice_/> <defaultWait_>10</defaultWait_> <purge_/> </structParm> <lengthOfReceiverVariable_>86</lengthOfReceiverVariable_> <formatName_>JOBI0100</formatName_> <structParm name="qualifiedJobName" passDirection="in" struct="qualifiedJobName"/> <internalJobIdentifier_> </internalJobIdentifier_> <errorCode_>0</errorCode_> </parameterList> </program> </xpcml>