PreviousNext
Help > API Functions > Job logs > Complete example
Complete example

 

Assuming you have this JOB by using the WRKACTJOB command:

 

 

The PHP program does:

         connection with i5_connect

         open JOB log with i5_jobLog_list

         get JOB log content with i5_jobLog_list_read

         close handle with i5_jobLog_list_close

 

            <?php

 

 

            $user = "user";

            $pass = "pwd";

            $connect = "power8";

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

 

            $TraceLvl = 4;

            $TraceFile = "CR/TRACEPHP2";

 

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

 

                    $jobName = "EASYCOMD";

                    $userName = "QTCP";

                    $jobNumber = "331521";

 

     $HdlJob = i5_jobLog_list(array(I5_JOBNAME=>$jobName,I5_USERNAME=>$userName,   I5_JOBNUMBER=>$jobNumber));

 

                    if (is_bool($HdlJob))

                    {

                                         $ret = i5_error();

                                         print_r($ret);

                    }

                    else

                    {

                                         $count = 0;

                                         $continue = true;

                                         while($continue)

                                         {

                                                             $data = i5_jobLog_list_read($HdlJob);

                                                             if (is_bool($data))

                                                             {

                                                                                 if (i5_errno() != 14)

                                                                                 {

                                                                                                      $ret = i5_error();

                                                                                                      print_r($ret);

                                                                                 }

                                                                                 break;

                                                             }

                                                             else

                                                             {

                                                                                 echo " - ".$data[I5_LOBJ_MSGDTA]."<BR>";

                                                                                 if (isset($data[I5_LOBJ_MSGHLP]))

                                                                                                      echo $data[I5_LOBJ_MSGHLP]."<BR>";

                                                                                 $count ++;

                                                                                 if ($count > 3) $continue = false;

                                                             }

                                         }

                    }

                    i5_jobLog_list_close($HdlJob);

 

?>