PreviousNext
Help > Développement > Fonctions W-Langage pour AS/400 > Fonctions Appel de Programmes/Procédure > Easycom XML >
Exemple complet

 

Appel du programme RPCSAMPLE dont la structure est définie en pcml.

Remarque : dans le pcml, pour la variable path, LIB et PGM doivent être en minuscules :

path="/QSYS.lib/EASYCOMXMP.lib/RPCSAMPLE.pgm"

sPCML est une chaîne

sParam est une chaîne

sResultat est un chaîne ANSI

 

 

sPCML = [

       <pcml version="4.0">

       <program name="RPCSAMPLE" path="/QSYS.lib/EASYCOMXMP.lib/RPCSAMPLE.pgm" >

       <data name="OP1" type="packed" length="5" precision="2" usage="input" />

       <data name="STR1" type="char" length="20" usage="input" />

       <data name="OP2" type="packed" length="5" precision="2" usage="inputoutput" />

       <data name="STR2" type="char" length="30" usage="inputoutput" />

       <data name="OP3" type="packed" length="10" precision="4" usage="output" />

       </program>

       </pcml>

]

 

sParam = [

       <OP1>%1</OP1>

       <STR1>%2</STR1>

       <OP2>%3</OP2>

       <STR2>%4</STR2>

       <OP3>%5</OP3>

]

 

STStrpcsample est Structure

       OP1 est réel

       STR1 est chaîne sur 20

       OP2 est réel

       STR2 est chaîne sur 30

       OP3 est réel

FIN

 

 

stRpcSample est STStrpcsample

stRpcSample.OP1 = 2

stRpcSample.STR1="aura"

stRpcSample.OP2 = 3

stRpcSample.STR2 = "test"

stRpcSample.OP3 = 4

 

sParam = ChaîneConstruit(sParam,stRpcSample.OP1,stRpcSample.STR1,stRpcSample.OP2,stRpcSample.STR2,stRpcSample.OP3)

 

SI PAS ASXMLDefinie("PCML",sPCML,PrinciConnexion) ALORS

       Info(ErreurInfo())

SINON

      

       sResultat = ASXMLAppelPgm("RPCSAMPLE",sParam,PrinciConnexion)

      

       Désérialise(stRpcSample,sResultat,psdXMLAgrégé)

       Info("OP1="+ stRpcSample.OP1 + " - STR1=" + stRpcSample.STR1 + " - OP2=" + stRpcSample.OP2 + " - STR2=" + stRpcSample.STR2 + " - STR3=" + stRpcSample.OP3)

       Info(sResultat)

FIN