i5_program_prepare_PCML

 

Opens a Program or Procedure using a PCML description, and prepares it to be run.

 

resource i5_program_prepare_PCML (

array description
string program_name
[,
resource connection])

 

Detail

 

The program information file (in PCML format) can be created by compiling the RPG

program.

 

Example:

 

CRTBNDRPG PGM(EACDEMO/TESTSTRUC) SRCFILE(EACDEMO/QRPGLESRC)

SRCMBR(TESTSTRUC) PGMINFO(*PCML)

INFOSTMF('/www/zendcore/htdocs/teststruc.pcml')

 

The PCML file will contain the program parameters info. There are two ways you can assign the program parameters to i5-program_prepare_PCML description:

 

- Copy the content of PCML file to you PHP script and assign the i5_program_prepare_PCML description array to the PCML content. See PCML example in PCML Example 1

- Assign i5_program_prepare description array to the PCML file located in the same PHP program directory. See PCML example in figure 2

 

 

 

Parameters

 

 

description

PCML file's program and parameters information.
This parameter string can contain the PCML description itself, or the path to a text file containing the PCML description.

Program_name

Program name is usually embedded inside the PCML file.
By setting this parameter, you can override the contain of the PCML file, and connect to another program having same description.

Program name is in the form:

LIBRARY/NAME
NAME, when program is in the job library list.

LIBRARY/NAME(Procedure), for a Procedure in a Service Program.
NAME(Procedure), when Service Program is in the LIBL.

connection

Result of i5_connect

 

Returns:

Resource if open succeeded, false if open failed.

 

I5_ERR_DESC_WRONG_DATAOP

41

Wrong operation on a data field of a description

I5_ERR_PARSEXML

42

Internal error; please contact Aura Equipement; error number 42

I5_ERR_PHP_OPTIONSTYPE

259

The type of " I5_OPTIONS_ALIAS" option must be x and not x

I5_ERR_PHP_OPTIONSNUMBER

260

Option number -1 is unknown.

I5_ERR_PHP_TYPEPARAM

262

Type of element x in parameter -1 must be y. Type z was provided.

I5_ERR_PHP_NO_DS_VALUE

307

You cannot set a value for 'Data Structure' x.

 

 

Example PCML

 

$description = "<pcml version=\"4.0\">

<!-- RPG module: TESTSTRUC -->

<!-- created: 2006-10-12-11.46.56 -->

<!-- source: EACDEMO/QRPGLESRC(TESTSTRUC) -->

<!-- 5 -->

<struct name=\"S2\">

<data name=\"ZOND2\" type=\"zoned\" length=\"10\" precision=\"5\"

usage=\"inherit\" />

<data name=\"PACK2\" type=\"packed\" length=\"19\" precision=\"5\"

usage=\"inherit\" />

<data name=\"PACK3\" type=\"packed\" length=\"19\" precision=\"5\"

usage=\"inherit\" />

<data name=\"ALPH2\" type=\"char\" length=\"20\" usage=\"inherit\" />

</struct>

<!-- 1 -->

<struct name=\"S1\">

<data name=\"ZOND\" type=\"zoned\" length=\"10\" precision=\"5\"

usage=\"inherit\" />

<data name=\"PACK1\" type=\"packed\" length=\"19\" precision=\"5\"

usage=\"inherit\" />

<data name=\"ALPH1\" type=\"char\" length=\"10\" usage=\"inherit\" />

</struct>

<program name=\"TESTSTRUC\" path=\"/QSYS.LIB/EACDEMO.LIB/TESTSTRUC.PGM\">

<data name=\"CODE\" type=\"char\" length=\"10\" usage=\"output\" />

<data name=\"S1\" type=\"struct\" struct=\"S1\" usage=\"inputoutput\" />

<data name=\"S2\" type=\"struct\" struct=\"S2\" usage=\"inputoutput\" />

<data name=\"PACK\" type=\"packed\" length=\"1\" precision=\"1\"

usage=\"output\" />

<data name=\"CH10\" type=\"char\" length=\"19\" usage=\"output\" />

<data name=\"CH11\" type=\"char\" length=\"20\" usage=\"output\" />

<data name=\"CH12\" type=\"char\" length=\"29\" usage=\"output\" />

<data name=\"CH13\" type=\"char\" length=\"33\" usage=\"output\" />

</program>

</pcml>

";

 

 

Exemple 2:

 

 

($description = file_get_contents("/www/zendcore/htdocs/teststruc.pcml"))

or trigger_error("Error while opening PCML file", E_USER_ERROR);