Program parameter values can be set in the XPCML source file. When the XPCML is read in and parsed, the ProgramCallDocument setValue method is called automatically for each parameter whose value has been passed in as XPCML. This relieves the user from having to write Java™ code to set the values of complicated structures and arrays.
In the following examples, the XPCML calls two different programs, prog1 and prog2. Both programs use the input parameter s1Ref. The first example sets different values for s1Ref for each program call. The second example specifies the same value for s1Ref for each program call, which illustrates a useful way to set constant data values for input parameters.
In the following example, after the XML parser reads in and parses the document, the value of element prog1.s1Ref.s2Ref.s2p1[0] is prog1Val_1 and the value of element prog1.s1Ref.s2Ref.s2p1[1] is prog1Val_2.
<xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xpcml.xsd" version="4.0"> <struct name="s1"> <stringParm name="s1p1"/> <structParm name="s2Ref" struct="s2"/> </struct> <struct name="s2"> <stringParm name="s2p1" length="10"/> <arrayOfStringParm name="parm1" count="2"/> </struct> <program name="prog1" path="/QSYS.LIB/W95LIB.LIB/PROG1.PGM"> <parameterList> <structParm name="s1Ref" struct="s1" passDirection="in" > <stringParm name="s1p1">prog1Val</stringParm> <structParm name="s2Ref" struct="s2"> <stringParm name="s2p1" length="10">prog1Val</stringParm> <arrayOfStringParm name="parm1" count="2"> <i>prog1Val_1</i> <i>prog1Val_2</i> </arrayOfStringParm> </structParm> </structParm> </parameterList> </program> <program name="prog2" path="/QSYS.LIB/W95LIB.LIB/PROG1.PGM"> <parameterList> <structParm name="s1Ref" struct="s1" passDirection="in" > <stringParm name="s1p1">prog2Val</stringParm> <structParm name="s2Ref" struct="s2"> <stringParm name="s2p1" length="10">prog2Val</stringParm> <arrayOfStringParm name="parm1" count="2"> <i>prog2Val_1</i> <i>prog2Val_2</i> </arrayOfStringParm> </structParm> </structParm> </parameterList> </program> </xpcml>
In the following example, after the XML parser reads in and parses the document, the value of element prog1.s1Ref.s2Ref.s2p1[0] is constantVal_1 and the value of element prog1.s1Ref.s2Ref.s2p1[1] is constantVal_2.
<xpcml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xpcml.xsd" version="4.0"> <struct name="s1" > <stringParm name="s1p1">constantVal</stringParm> <structParm name="s2Ref" struct="s2"/> </struct> <struct name="s2"> <stringParm name="s2p1" length="10">constantVal</stringParm> <arrayOfStringParm name="parm1" count="2"> <i>constantVal_1</i> <i>constantVal_2</i> </arrayOfStringParm> </struct> <program name="prog1" path="/QSYS.LIB/W95LIB.LIB/PROG1.PGM"> <parameterList> <structParm name="s1Ref" struct="s1" passDirection="in" /> </parameterList> </program> <program name="prog2" path="/QSYS.LIB/W95LIB.LIB/PROG1.PGM"> <parameterList> <structParm name="s1Ref" struct="s1" passDirection="in" /> </parameterList> </program> </xpcml>