XPCML differs from PCML in several ways, but one major difference is that XPCML allows you to specify the values of input parameters within the XPCML source file.
PCML allows you to use the init attribute of the <data> tag to specify the initial value for a data element in the PCML source. However, using PCML to specify values has the following limitations:
To specify array values in PCML, you must first read in and parse the PCML document, then perform a series of calls to ProgramCallDocument.setValue().
Using XPCML makes it easier to specify values of single elements and arrays:
The following simple comparisons indicate ways in which XPCML differs from PCML. Each example defines a program call for an iSeries™ server program.
The following examples call an iSeries server program called prog1.
XPCML source code
<?xml version="1.0" encoding="UTF-8"?> <xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='xpcml.xsd' version="4.0"> <program name="prog1" path="/QSYS.LIB/W95LIB.LIB/PROG1.PGM"> <parameterList> <stringParm name="parm1" passDirection="in" length="10">Parm1</stringParm> <intParm name="parm2" passDirection="in">5</intParm> <shortParm name="parm3" passDirection="in">3</shortParm> </parameterList> </program> </xpcml>
PCML source code
<pcml version="4.0"> <program name="prog1" path="QSYS.LIB/MYLIB.LIB/PROG1.PGM"> <data name="parm1" type="char" usage="input" length="10" init="Parm1"/> <data name="parm2" type="int" usage="input" length="4" init="5"/> <data name="parm3" type="int" usage="input" length="2" precision="16" init="3"/> </program> </pcml>
The following examples call an iSeries server program called prog2 and define parm1 as an array of string parameters. Note the functionality of XPCML:
You can take advantage of this XPCML functionality without writing any Java™ code.
PCML cannot match the XPCML performance. PCML cannot initialize the value of each element in the array. PCML cannot validate the init values at parse time. To match the functionality of XPCML, you would have to read in and parse the PCML document, then code your Java application to set the value for each array element. You would also have to write code to validate the parameters.
XPCML source code
<?xml version="1.0" encoding="UTF-8"?> <xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xpcml.xsd" version="4.0"> <program name="prog2" path="/QSYS.LIB/W95LIB.LIB/PROG2.PGM"> <parameterList> <arrayOfStringParm name="parm1" passDirection="in" length="10" count="3"> <i>Parm1-First value</i> <i>Parm1-Second value</i> <i>Parm1-Third value</i> </arrayOfStringParm> <longParm name="parm2" passDirection="in">5</longParm> <zonedDecimalParm name="parm3" passDirection="in" totalDigits="5" fractionDigits="2">32.56</zonedDecimalParm> </parameterList> </program> </xpcml>
PCML source code
<pcml version="4.0"> <program name="prog2" path="QSYS.LIB/MYLIB.LIB/PROG2.PGM"> <data name="parm1" type="char" usage="input" length="20" count="3"/> <data name="parm2" type="int" usage="input" length="8" init="5"/> <data name="parm3" type="zoned" usage="input" length="5" precision="2" init="32.56"/> </program> </pcml>