i5_command

 

Calls CL command.

 

bool i5_command (

string command
[,
array inputs, array outputs
[,
resource connection])

 

Details

 

Out parameter can be returned by the command.

 

Parameters

 

inputs

Array of name => value parts, name describing the call input parameters.

Names should match i5 CL command parameter names.

If the array is empty or not provided, no input parameters are given. If the value is integer,

integer is passed, if the value is string, quoted string is passed. If the value is an array, the

list of contained values is passed.

Note: The output parameter is required if the input parameter is specified.

 

 

Outputs

Array which describes output parameters of the command. If not provided, no output parameters are defined.

Key of the array defined i5 CL command parameter name

"rc" is a predefined name containing the result of the command.

Value can be string. If so - it defines a php variable name to accept the parameter or array;

it should have 2 elements:

- A php variable name to accept the parameter.

- Description of the parameter

Note: The input parameter is required if the output parameter is specified.

 

 

connection

Connection - result of i5_connect.

 

 

Returns:

True if OK, false if failed.

 

I5_ERR_PHP_HDLDFT

256

No default connection found.

I5_ERR_PHP_HDLCONN

257

This resource has no connection active.

I5_ERR_PHP_RESOURCE_BAD

261

No resource found .

I5_ERR_PHP_TYPEPARAM

262

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

I5_ERR_PHP_INTERNAL

288

Internal error; please contact Aura Equipement; error number 288

I5_ERR_PHP_NO_PARMNAME

293

Internal error; please contact Aura Equipement; error number 293

I5_ERR_PHP_NO_ZVALUE

294

Internal error; please contact Aura Equipement; error number 294

 

 

Example

 

 

/*This is a direct, simple, command, with no output values*/

$ret = i5_command("CLRSAVF FILE(EASYCOM/SAVOBJ)");

 

/* This is also a direct command, but with separate values*/

/* This is equivalent to SAVOBJ OBJ('PGM1 PGM2 PGM3')*/ /*LIB(MY_LIB) DEV(*SAVF) OBJTYPE(*PGM) SAVE(EASYCOM/SAVOBJ)*/

$Input = array(

 "OBJ" => array("PGM1","PGM2","PGM3"),

 "LIB" => "MY_LIB",

 "DEV" => "*SAVF",

 "OBJTYPE" => "*PGM",

 "SAVF" => "EASYCOM/SAVOBJ"

);

$Output = array();

$ret = i5_command("SAVOBJ", $Input, $Output);

 

/* Now, a command with return value */

/*This is like in CL: RTVJOBA USER(&USER) SYSLIBL(&SYSLIB)*/

$ret = i5_command ("RTVJOBA", array(), array(

"curlib" => "curl",

"user" => "user",

"usrlibl" => "userlib",

"syslibl" => array("syslib",

"char(165)"))

);

print "User : $user<br>";

print "User library: $userlib<br>";

print "system libs list : $syslib<br>";