<?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: Passing in parameter values as XPCML" /> <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="rzahhxpcmlexmplregpass" /> <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: Passing in parameter values as XPCML</title> </head> <body id="rzahhxpcmlexmplregpass"><a name="rzahhxpcmlexmplregpass"><!-- --></a> <!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script> <h1 class="topictitle1">Example: Passing in parameter values as XPCML</h1> <div><div class="section"><p>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.</p> <p>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.</p> </div> <div class="section"><h4 class="sectiontitle">Example: Passing in different values for input paramters</h4><p>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.</p> <pre> <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></pre> </div> <div class="section"><h4 class="sectiontitle">Example: Passing in constant values for input paramters</h4><p>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.</p> <pre> <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></pre> </div> </div> </body> </html>