This function loads Procedure or Program definitions from an immediate PCML or simplified RPG source.
bool i5_XmlDefine (string Source_type, string Source_String[, resource Connection ])
Parameters
source_type |
Type of source provided in the Source String. • PCML: Definition is in PCML format. • S-RPG: Definition is in RPG like syntax. |
source_string |
Structures and Procedure definitions. In PCML or S-RPG format |
connection |
Easycom Connection - Result of i5_connect() or i5_pconnect(). |
Return
True / False.
Details
Data structures, programs and procedures are defined in a character string provided by the PHP script.
Program and procedure prototypes are stored in the current Easycom job.
Simplified
RPG is like RPG. Statements are ended by a semi colon.
There are no column restrictions. Keywords can be anywhere in the line.
/COPY directive can used in S-RPG definitions, to load external RPG source members.
PR keyword is
used to declare a procedure.
If the procedure maps to a program (*PGM) use standard RPG keyword EXTPGM
to point to the real program.
If the procedure maps to a procedure in a service program, use keyword EXTPROC
to give the real procedure name, if it is different from the name used and
defined by PHP.
DS keyword is used
to define data structures.
EXTNAME keyword can be used to define an external data structure from a
physical file description. In that case, special letter E is present
before DS keyword.
CONST keyword sets parameter as INPUT only.
Examples
Example 1 : Define a procedure using PCML.
PCML (Program Call Markup Language) is defined by IBM. Refer to IBM documentation for a complete description.
You can make the RPG compiler generate a PCML description of your procedures.
On CRTRPGMOD command, set option PGMINFO(*PCML) INFOSTMF(IFS file path).
A stream file will be created on the IFS. See i5_XmlLoadDefinition function to load the generated file.
$PCML = '<pcml version="1.0">
<program name="QUSLOBJ0200" Path="QUSRTVUS">
<data name="USSPC" type="struct" struct="QNAME" usage="input" />
<data name="START" type="int" length="4" usage="input" />
<data name="DATALEN" type="int" length="4" usage="input" />
<data name="RCVVAR" type="struct" struct="QUSL020002" usage="output"
outputsize="DATALEN" Count="COUNT" />
<data name="COUNT" type="int" length="4" usage="input" Passby="Nothing" />
</program>
</pcml>';
$XMLStr = i5_XmlDefine ("PCML", $PCML);
if (!$XMLStr)
{
print_r("i5_XmlDefine error : ".i5_errormsg().'<br/>');
}
Example 2 : Define a procedure that maps to a program. Define an external DS.
$SRPG = "DS_CUST E DS extname(SP_CUST:RSP_CUST);
PSPCUST PR EXTPGM('PSPCUSTR');
Result LIKEDS(DS_CUST);
TERM1 5S 0 CONST;";
$XMLStr = i5_XmlDefine ("s-rpg", $SRPG);
...
$ArrayIn = array("TERM1"=>$InputValue);
$ArrayOut = i5_XmlCallProgram ("PSPCUST", $ArrayIn);
Example 3 : Define DS and Procedure. Procedure is in service program – Bind Service program.
$SRPG = "DS_A DS;
MBR1 10a;
MBR2 10a inz('Member 2');
MBR3 8p2;
SampleDS1 PR;
PARM1 10a;
PARM2 8p2;
PARM3 likeds(DS_A);";
$XMLStr = i5_XmlDefine ("s-rpg", $SRPG);
i5_XmlBindSrvPgm ("SRVPTEST1");
...
$ArrayOut = i5_XmlCallProgram ("SAMPLEDS1", $ArrayIn);
See also