Jump to content

Recommended Posts

 Hi,

I am getting the following error message when running my script.
It worked recently, a library was restored and now I'm getting this.

ITW0002CL in ITWEB type *N not found. SQLCODE=-204 ITW0002CL in ITWEB type *N not found. SQLCODE=-204

The library (ITWEB) and program (ITW0002CL) do exist and the authority to those objects is more than sufficient.
The script works flawlessly when accessing any other system.

I've debugged it in Zend Studio (Debug URL) specifying a system it works on and the one it is not finding the object on and all values in the variables are as they should be.

I'm at a loss to figure out why it does not find the program object when it does exist.

Not sure if it will help but the code (partially edited) is below.

Any help would be greatly appreciated.

bgg
 


<?php

// show generic header

include ("../includes/iheader.php");

// show generic top navigation

include ("../includes/iTopNavigate.php");

print ("<div id=body>");

print ("<div style=text-align: left;></div>");

print ("<div id=content>");

print ("<div style=text-align: left;></div>");

print ("<div style=text-align: right;>");

print ("<br />");

print ("<div style=text-align: left;>");





//Establish connection to remote systems after getting correct connection

// parms

ini_set('display_startup_errors', 0) ;

ini_set('display_errors', 0) ;

ini_set('log_errors', 1) ;

ini_set('error_reporting', E_ALL | E_STRICT) ;



$filename=$_POST['filename'];

$library=$_POST['library'];

$selected=$_POST['select'];

$parmIN1 = $filename;

$parmIN2 = $library;

$parmIN3 = '*FILE';

$parmOUT3 = '                     ';

$database = " ";

$stmt = " ";

$codetext = '  ';

$JOURNAL = '  ';

$host = '';

$hasystem = '         ';



$conn = i5_connect('', '', '');



$description = array(

    array(

       "Name"=>"CONPA",

       "IO"=>I5_INOUT,

       "Type"=>I5_TYPE_CHAR,

       "Length"=>"10"

    ),

    array(

       "Name"=>"RTVPRF",

       "IO"=>I5_INOUT,

       "Type"=>I5_TYPE_CHAR,

       "Length"=>"10"

    ),

    array(

       "Name"=>"NODE",

       "IO"=>I5_INOUT,

       "Type"=>I5_TYPE_CHAR,

       "Length"=>"8"

    ),

);



$pgm = i5_program_prepare('ITWEB/WEBCONGET', $description);

if (!$pgm) {

    throw_error("i5_program_prepare");

    exit();

}



$parameter = array(

    "CONPA"=>"          ",

    "RTVPRF"=>"",

    "NODE"=>"$host"

);



$parmOut = array(

    "CONPA"=>"CONPA"

);



$ret = i5_program_call($pgm, $parameter, $parmOut);

if ($ret === FALSE)

{

$errorTab = i5_error();

echo "FAIL : i5_program_call failure code <br>";

die();

}



i5_program_close($pgm);

i5_close($conn);



function throw_error($func) {

   echo "Error in function: ".$func." --- ";

   echo "Error Number: ".i5_errno()." --- ";

   echo "Error Message: ".i5_errormsg()."<br>";

}









      $queryhasys = "Select * from ITWEBLCL.syslst where  SALI = '$selected' ";

      $host = "*LOCAL";

      $conn3 = db2_connect ($host,"", "");

      echo db2_stmt_errormsg();



      // Get the HA system name so we can add that system name to the search

      $queryexe = db2_exec($conn3, $queryhasys) ;

      while(db2_fetch_row($queryexe))

      {

      $SHAS = db2_result($queryexe, 'SHAS'); // System Name HA Name

      $SALI = db2_result($queryexe, 'SALI'); // System Name Prod Alias

      $SHDN = db2_result($queryexe, 'SHDN'); // HA System DNS name

      $SPRD = db2_result($queryexe, 'SPRD'); // Production DNS name

      $SRDB = db2_result($queryexe, 'SRDB'); // relational database name

      $hasystem = $SHAS;

            }



$host = $selected;



if ($SRDB !== '       ') {

   $host = $SRDB;

   }



$conn2 = db2_connect($host,"",$CONPA );



$proc = "CALL ITWEB.ITW0002CL(?, ?, ?, ?)";



$stmt = db2_prepare($conn2, $proc);

echo db2_stmt_errormsg();





db2_bind_param($stmt, 1, "parmIN1", DB2_PARAM_IN);

db2_bind_param($stmt, 2, "parmIN2", DB2_PARAM_IN);

db2_bind_param($stmt, 3, "parmIN3", DB2_PARAM_IN);

db2_bind_param($stmt, 4, "parmOUT3", DB2_PARAM_OUT);





db2_execute($stmt);

echo db2_stmt_errormsg();



switch (substr($parmOUT3, 0, 2)) {

   case '01':

      $codetext = "Object not found in library $library";

      print ("<p><h2>File $filename in $library could not be checked on system $selected, the error returned was - $codetext</h2></p>");

     break;

   case '02':

      $codetext = "Not Authorized to object in library $library";

      print ("<p><h2>File $filename in $library could not be checked on system $selected, the error returned was - $codetext</h2></p>");

   break;

   case '03':

      $codetext = "Library $library not found";

       print ("<p><h2>File $filename in $library could not be checked on system $selected, the error returned was - $codetext</h2></p>");

   break;

   case '04':

      $codetext = 'Member not found in file';

      print ("<p><h2>File $filename in $library could not be checked on system $selected, the error returned was - $codetext</h2></p>");

   break;

   case '05':

      $codetext = "Not authorized to use library $library";

       print ("<p><h2>File $filename in $library could not be checked on system $selected, the error returned was - $codetext</h2></p>");

   break;

   case '06':

      $codetext = 'Cannot assign library';

       print ("<p><h2>File $filename in $library could not be checked on system $selected, the error returned was - $codetext</h2></p>");

   break;

   case '07':

      $codetext = 'Error occured during processing of command';

       print ("<p><h2>File $filename in $library could not be checked on system $selected, the error returned was - $codetext</h2></p>");

   break;

   case 'NJ':

      $codetext = 'Object has no journal associated';

      print ("<p><h2>File $filename in $library is not journaled on system $selected. No journal information retrieved</h2></p>");

   break;

   case 'AA':

      // if the code is AA then we got a good return and we can start the page

         $codetext = 'Journal information found';

         $JOURNAL = substr($parmOUT3, 2, 10);

         $JOURNLIB = substr($parmOUT3, 12, 10);



      $queryhasys = "Select * from ITWEBLCL.syslst where  SALI = '$selected' ";

      $host = "*LOCAL";

      $conn3 = db2_connect ($host,"", "");

      echo db2_stmt_errormsg();



      // Get the HA system name so we can add that system name to the search

      $queryexe = db2_exec($conn3, $queryhasys) ;

      while(db2_fetch_row($queryexe))

      {

      $SHAS = db2_result($queryexe, 'SHAS'); // System Name HA Name

      $SALI = db2_result($queryexe, 'SALI'); // System Name Prod Alias

      $SHDN = db2_result($queryexe, 'SHDN'); // HA System DNS name

      $SPRD = db2_result($queryexe, 'SPRD'); // Production DNS name

      $hasystem = $SHAS;

            }

        $jrnsql = "Select * from itweblcl.itw0006pf where (itwjsysa = '$hasystem' and itwjjrn = '$JOURNAL') or (itwjsysa = '$selected' and itwjjrn = '$JOURNAL') order by ITWJATDAT DESC , ITWJATTIM DESC";



      $queryexe = db2_exec($conn3, $jrnsql) ;

      echo db2_stmt_errormsg();



         print ("<p><h3>Journal information requested for file $filename in library $library on system $selected</h3>");

         print ("<h3>The journal associated with the file is $JOURNAL in $JOURNLIB</h3></p>");

         print ("<br><br>");

         print ("<table><tr><b><td>Node</td><td>Receiver  Name  </td><td> Receiver Library   </td><td>   Attached        Date      </td><td> Attached Time </td><td>   Detached       Date       </td><td> Detached Time </td><td> Status</td><td>Backup Tape </td> <td>   Tape   Expiration&nbsp</td></b>\n");





         while(db2_fetch_row($queryexe))      {

         $ITWJSYS = db2_result($queryexe, 'ITWJSYS');       // System Name

         $ITWJSYSA = db2_result($queryexe, 'ITWJSYSA');       // system alias

         $ITWJJRN = db2_result($queryexe, 'ITWJJRN');       // journal

         $ITWJJRNL = db2_result($queryexe, 'ITWJJRNL');       // journal library

         $ITWJJRNRC = db2_result($queryexe, 'ITWJJRNRC');    // receiver

         $ITWJJRNRL = db2_result($queryexe, 'ITWJJRNRL');    // receiver library

         $ITWJATDAT = db2_result($queryexe, 'ITWJATDAT');    // attached date

         $ITWJATTIM = db2_result($queryexe, 'ITWJATTIM');    // attached time

         $ITWJDTDAT = db2_result($queryexe, 'ITWJDTDAT');    // detached date

         $ITWJDTTIM = db2_result($queryexe, 'ITWJDTTIM');    // detached time

         $ITWJRNRSTA = db2_result($queryexe, 'ITWJRNRSTA');    // journal status

         $ITWJRNTAP = db2_result($queryexe, 'ITWJRNTAP');    // Journal Tape ID

         $ITWTAPSTA = db2_result($queryexe, 'ITWTAPSTA');    // Tape Status

         $ITWTAPEXP = db2_result($queryexe, 'ITWTAPEXP');    // Tape Expiration



   // Lets blank the date if its the defualt value

         if ($ITWTAPEXP == '0001-01-01') {

               $ITWTAPEXP = '          ';

            }

   // Lets blank the date if its the defualt value

         if ($ITWJDTDAT == '0001-01-01') {

               $ITWJDTDAT = '          ';

            }

   // Lets blank the date if its the defualt value

         if ($ITWJDTTIM == '00.00.00') {

               $ITWJDTTIM = '          ';

            }





         print ("<tr><td>$ITWJSYS</td><td><form name=setit method=post action=http://primintl/Journal/iJrnSetAut.php><input type=hidden name=SHDN value=$SHDN><input type=hidden name=ITWJJRN value=$ITWJJRN><input type=hidden name=SPRD value=$SPRD><input type=hidden name=ITWJJRNL value=$ITWJJRNL><input type=hidden name=CONPA value=$CONPA ><input type=submit value=$ITWJJRNRC></form></td>

      <td> $ITWJJRNRL </td><td> $ITWJATDAT </td><td> $ITWJATTIM </td><td> $ITWJDTDAT </td><td> $ITWJDTTIM </td><td> $ITWJRNRSTA </td><td> $ITWJRNTAP</td><td> $ITWTAPEXP </td></tr>\n");



      }



   print("</tbody>");

   print("</table>");

   break;

    }







// if the connection has failed, let the user know and clean up the screen

if (!$conn2){

   print ("<b> <h3>Connection to iSeries $host database failed </h3><b></b>\n");

   print db2_conn_errormsg();



   die( "Connection error is :" . i5_errormsg());

exit();

}

db2_close($conn);

db2_close($conn2);

db2_close($conn3);

//Show the flag banner at the bottom of the page

print("<br>");

print("<br>");



//Show the flag banner at the bottom of the page

include_once ("../includes/iFlags.php");



// Show left Navigation

include_once ("../includes/iNavigate.php");



// Show the common footer

include_once("../includes/ifooter.php");



// Column Header

function Print_Head($ColHdg) {

print("<hr style=WIDTH: 91.41%; HEIGHT: 3px align=center size=1 width=100.00%/>");

print("<tr> <th colspan=3><h3>$ColHdg</h3></th></tr> \n");

print("<left><table width=10% cellpadding=1>");    // will control the flag bottom position and the left tool bar

print("<tbody>");



}

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/290955-php-on-ibm-i-slq-error-204/
Share on other sites

Yeah, sorry.  It's actually failing on the Prepare statement.  The code works because as I say, I have successful connections to other systems.

 

 

$conn2 = db2_connect($host,"",$CONPA );
$proc = "CALL ITWEB.ITW0002CL(?, ?, ?, ?)";
$stmt = db2_prepare($conn2, $proc);

As a test, connecting to a 'host' system I know this works on, I copied that ITW0002CL program to another library, modified the code to reflect that and I got the same message.  ITW0002CL in 'yourlibrary' type *N not found

 

I also changed the code to reflect a different program name and still get the same 'not found' message.  I assume becaue the parms needed are different

 

The Debug warning message is

db2_prepare(): Statement Prepare Failed

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.