Opens a data queue with optional description.
ressource i5_dtaq_prepare (string name, array description [, int key] [, resource connection])
Parameters
name |
The data queue name. |
description |
PHP-format program description. See: PHP Data Description
|
key |
Key size - for keyed DataQ, value given in the KEYLEN parameter of the CRTDTAQ command
|
connection |
Connection - result of i5_connect
|
Return
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_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
I5_ERR_PHP_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
I5_ERR_PHP_NBPARAM_BAD |
263 |
Wrong parameter count |
I5_ERR_PHP_BAD_TYPE_KEYNAME |
271 |
The name property n°-1 must be a string. |
I5_ERR_PHP_ELEMENT_MISSING |
304 |
An element of the array has a wrong type within function_name (type) function. |
I5_ERR_PHP_ELEMENT_MISSING |
304 |
An element of the array has a wrong type within function_name (type) function. |
I5_ERR_PHP_BAD_DEF |
305 |
You cannot define an occurrence number, and an occurrence reference for the same parameter -1. |
I5_ERR_PHP_BAD_KEYNAME |
306 |
Name x is not a property name for a program description |
I5_ERR_PHP_DESC_EMPTY |
310 |
The description array is empty. |
I5_ERR_PHP_EMPTY_NAME |
314 |
Object name can not be empty |
Example
/* Connection */
$Hdlcon = i5_connect($adresse,$user, $mdp, $jobName);
/* Open the DATA QUEUE */
$description = array("Name"=>"DATA", "Type"=>I5_TYPE_CHAR, "Length"=>"50");
$data = i5_dtaq_prepare("*LIBL/DTAQ_FIFO", $description);
if ($data == false){
$erreur = i5_error();
print_r ($erreur);
}
$msg='';
$lecture = false;
/* Writing in the data queue */
if (isset($_POST["write"])) {
$donnees = $_POST["data"];
$ret = i5_dtaq_send($data, "", $donnees);
if ($ret) {
$msg="Ecriture faite";
}
}
/* reading of the data queue */
if (isset($_POST["read"])) {
$rec = i5_dtaq_receive($data);
if (is_bool($rec)) {
$erreur = i5_error();
if ($erreur[0]==14) {
$msg="La Data Queue est vide";
} else {
print_r($erreur);
}
} else {
$lecture = true;
}
}