PreviousNext
Help > XML Easycom > Examples > Example: QBNRPII API
Example: QBNRPII API

 QBNRPII is a system API. It returns the PCML description for each module bound in a service program.

 

QBNRPII is defined by a PCML stream file as follow:

 

<pcml version="1.0">

  <struct name="QName">

    <data name="Obj"  type="char"  length="10" />

    <data name="Lib"  type="char"  length="10" init="*LIBL" />

  </struct>

 

  <struct name="Entry">

    <data name="OffsetNextEntry"  type="int"  length="4" />

    <data name="ModuleName" type="char"  length="10" />

    <data name="ModuleLib"  type="char"  length="10" />

    <data name="InterfaceInfoCCSID"     type="int"  length="4" />

    <data name="InterfaceInfoType"type="int"  length="4" />

    <data name="InterfaceInfoOffset"    type="int"  length="4" />

    <data name="InterfaceInfoReturn"    type="int"  length="4" />

    <data name="InterfaceInfoAvail"     type="int"  length="4" />

    <data name="InterfaceInfo"    type="char"  length="InterfaceInfoReturn" 

          offset="InterfaceInfoOffset" offsetfrom="receiver"/>

    <data type="byte"  length="0" 
          offset="OffsetNextEntry" offsetfrom="receiver"/>

  </struct>

  

  <struct name="receiver">

    <data name="BytesReturn"type="int"  length="4" />

    <data name="BytesAvail" type="int"  length="4" />

    <data name="ObjName"    type="char"  length="10" />

    <data name="ObjLib"     type="char"  length="10" />

    <data name="ObjType"    type="char"  length="10" />

    <data name="filer1"     type="char"  length="2" />

    <data name="OffsetFirstEntry" type="int"  length="4" />

    <data name="NumberOfEntries"  type="int"  length="4" />

    <data  type="byte"  length="0" 
           offset="OffsetFirstEntry" offsetfrom="receiver" />

    <data name="Entries"  type="struct" struct="Entry" Count="NumberOfEntries" />

  </struct>

  

  <program name="qbnrpii" path="/QSYS.lib/QBNRPII.pgm" >

    <data name="receiver"     type="struct" struct="receiver" 
          usage="output"  outputsize="receiverLength"/>

    <data name="receiverLength" type="int" length="4" usage="input" 
          init="4096" />

    <data name="formatName"  type="char"   length="8" usage="input" 
          init="RPII0100" />

    <data name="QObjName"    type="struct" struct="QName" usage="input" />

    <data name="ObjType"     type="char"   length="10" usage="input" 
          init="*SRVPGM" />

    <data name="QBndModName" type="char"   length="20" usage="input" 
          init="*ALLBNDMOD"/>

    <data name="errorCode"   type="int"    length="4" usage="input" init="0" />

  </program>

</pcml>

 

Program definition is loaded from PCML stream file by following XML Easycom request:

 

<?xml version="1.0" encoding="utf-8" ?>

<Easycom>

  <define>

    <file stmf="/tmp/sr/qbnrpii.pcml" type="PCML" />

  </define>

</Easycom>

 

Program is called by following XML Easycom request:

 

<?xml version="1.0" encoding="utf-8" ?>

<Easycom>

<Program Name="qbnrpii">

   <parameterList>

      <receiverLength>4096</receiverLength>

      <QObjName>

         <Obj>RPGPRC01</Obj>

         <Lib>SR</Lib>

      </QObjName>

   </parameterList>

</Program>

</Easycom>

 

Following XML stream is returned back:

 

For each module, value of "receiver.Entries.i[n].InterfaceInfo" is the PCML description of the module entry points.

 

<?xml version="1.0" ?>

<PCML Load... Time="2011-01-24 18:06:11.396" Clock="0"/>

<end PCML Load... Time="2011-01-24 18:06:11.400" Clock="3"/>

<Call... Time="2011-01-24 18:06:11.400" Clock="3"/>

<Init... Time="2011-01-24 18:06:11.401" Clock="4"/>

<Program name="qbnrpii">

  <ParameterList>

    <receiver Type="Struct">

<BytesReturn>1496</BytesReturn>

<BytesAvail>1496</BytesAvail>

<ObjName>RPGPRC01</ObjName>

<ObjLib>SR</ObjLib>

<ObjType>*SRVPGM</ObjType>

<filer1></filer1>

<OffsetFirstEntry>48</OffsetFirstEntry>

<NumberOfEntries>2</NumberOfEntries>

<Program/>

<Entries Type="Array" count="2">

  <i Type="Struct">

    <OffsetNextEntry>1364</OffsetNextEntry>

    <ModuleName>CUST_DIM</ModuleName>

    <ModuleLib>SR</ModuleLib>

    <InterfaceInfoCCSID>37</InterfaceInfoCCSID>

    <InterfaceInfoType>1</InterfaceInfoType>

    <InterfaceInfoOffset>92</InterfaceInfoOffset>

    <InterfaceInfoReturn>1270</InterfaceInfoReturn>

    <InterfaceInfoAvail>1270</InterfaceInfoAvail>

    <InterfaceInfo>&ltpcml version=&quot4.0&quot&gt &ltstruct name=&quotDS_CUST&quot&gt &ltdata name=&quotCUST_ID&quot type=&quotzoned&quot length=&quot5&quot \

precision=&quot0&quot usage=&quotinherit&quot /&gt &ltdata name=&quotCOMPANY&quot type=&quotchar&quot length=&quot30&quot usage=&quotinherit&quot /&gt &ltdata \

name=&quotFIRSTNAME&quot type=&quotchar&quot length=&quot20&quot usage=&quotinherit&quot /&gt &ltdata name=&quotLASTNAME&quot type=&quotchar&quot \

length=&quot20&quot usage=&quotinherit&quot /&gt &ltdata name=&quotCIVIL&quot type=&quotchar&quot length=&quot1&quot usage=&quotinherit&quot /&gt &ltdata \

name=&quotADDRESS&quot type=&quotchar&quot length=&quot30&quot usage=&quotinherit&quot /&gt &ltdata name=&quotADDR2&quot type=&quotchar&quot length=&quot30&quot \

 usage=&quotinherit&quot /&gt &ltdata name=&quotCITY&quot type=&quotchar&quot length=&quot15&quot usage=&quotinherit&quot /&gt &ltdata name=&quotSTATE&quot \

type=&quotchar&quot length=&quot20&quot usage=&quotinherit&quot /&gt &ltdata name=&quotZIP&quot type=&quotchar&quot length=&quot10&quot usage=&quotinherit&quot\

 /&gt &ltdata name=&quotCOUNTRY&quot type=&quotchar&quot length=&quot20&quot usage=&quotinherit&quot /&gt &ltdata name=&quotPHONE&quot type=&quotchar&quot \

length=&quot15&quot usage=&quotinherit&quot /&gt &ltdata name=&quotFAX&quot type=&quotchar&quot length=&quot15&quot usage=&quotinherit&quot /&gt &lt/struct&gt \

&ltprogram name=&quotCUST_DIM&quot entrypoint=&quotCUST_DIM&quot&gt &ltdata name=&quotRESULT&quot type=&quotstruct&quot struct=&quotDS_CUST&quot count=&quot20&quot \

usage=&quotinputoutput&quot /&gt &ltdata name=&quotTOREAD&quot type=&quotint&quot length=&quot4&quot precision=&quot31&quot usage=&quotinputoutput&quot /&gt \

&ltdata name=&quotIO&quot type=&quotint&quot length=&quot4&quot precision=&quot31&quot usage=&quotinputoutput&quot /&gt &ltdata name=&quotTERM1&quot \

type=&quotzoned&quot length=&quot5&quot precision=&quot0&quot usage=&quotinputoutput&quot /&gt &lt/program&gt&lt/pcml&gt</InterfaceInfo>

    <Program/>

  </i>

  <i Type="Struct">

    <OffsetNextEntry>0</OffsetNextEntry>

    <ModuleName>CVTNW_PRC</ModuleName>

    <ModuleLib>SR</ModuleLib>

    <InterfaceInfoCCSID>37</InterfaceInfoCCSID>

    <InterfaceInfoType>1</InterfaceInfoType>

    <InterfaceInfoOffset>1408</InterfaceInfoOffset>

    <InterfaceInfoReturn>88</InterfaceInfoReturn>

    <InterfaceInfoAvail>88</InterfaceInfoAvail>

    <InterfaceInfo>&ltpcml version=&quot4.0&quot&gt &ltprogram name=&quotCVTNW_PRC&quot entrypoint=&quotCVTNW_PRC&quot&gt &lt/program&gt&lt/pcml&gt</InterfaceInfo>

    <Program/>

  </i>

</Entries>

    </receiver>

  </ParameterList>

</Program>