PreviousNext
Help > API Functions > Spools > i5_spool_get_data
i5_spool_get_data

 

Get the data from the spool file.

 

string i5_spool_get_data (string spool_name,

     string jobname,
       int job_number,
       string username,
       int spool_id
      [, string filename]
      [, resource connection])

Parameters

 

 

spool_name

The spool file name

 

job_name

The name of the job that created the file

 

job_number

The number of the job that created the file

 

username

The username of the job that created the file

 

spool_id

ID of the spool file in the queue (as returned by outq_read)

 

filename

IFS filename to store the data. If not provided, the data is returned as string

IF Easycom server and WEB server are on the same machine, *LOCAL can be specified to not use IFS functionalities of Easycom and increase performances.

In this case the function returns the data of the spool

 

connection

Connection – result of i5_connect

 

 

Return

 

String is returned if the “filename” parameter is not filled. False if function fails.

 

I5_ERR_DESC_WRONG_DATAOP

41

Wrong operation on a data field of a description

I5_ERR_PARSEXML

42

Internal error; please contact Aura Equipements. 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_BAD_DEF

305

You cannot define an occurrence number, and an occurrence reference for

 the same parameter -1.

 

Example

Assuming you have this spool by using the WRKSPLF command:

 

 

 

            <?php

 

 

            $user = "user";

            $pass = "pwd";

            $connect = "power8";

            $property = array (I5_OPTIONS_JOBNAME => "PHPSPL" );

 

            $TraceLvl = 4;

            $TraceFile = "CR/TRACEPHP2";

 

            $Hdlcon = i5_connect($connect, $user, $pass, $property);

 

                    $splfName = "SAMPLEDS1";

                    $jobName = "NISSA01";

                    $userName = "CRSECOFR";

                    $jobNumber = 316946;

                    $spoolNbr =  3 ;

 

     $data = i5_spool_get_data($splfName, $jobName, $userName, $jobNumber, $spoolNbr);

 

                    if (is_bool($data)){

                                         echo "Get data Spool has failed.<br/>";

                                          $ret = i5_error();

                                         printError($ret);

                                         return;

                    } else {

                                        if(function_exists('mb_convert_encoding')){

                                                             $data = mb_convert_encoding($data, "UTF-8","iso-8859-1");

                                        }

                                         echo $data . '<br/>';

                                         return;

                    }

 

?>