"How to" DS Array (AddDataStruct)

Posts: 222
Joined: Fri Jul 24, 2009 6:28 pm

Re: "How to" DS Array (AddDataStruct)

Post by rangercairns » Tue Oct 30, 2012 7:54 pm

In ZZCUST example i am using ibm_db2 to directly call stored procedures created by xmlservice download (XMLSERVICE.iPLUG4K .. XMLSERVICE.iPLUG15M). Zend Server has these same stored procedures already created in ZENDSVR library (ZENDSVR.iPLUG4K .. ZENDSVR.iPLUG15M).

TIP: You can share same connection between PHP Toolkit and regular ibm_db2 used ofr other purposes in your script, therefore your PHP script can use both raw XML (example above) and Toolkit (Alan) in the same PHP script. BTW -- If you have a DB2/ODBC driver on your laptop (Windows/Linux/Mac), you could call these stored procedures 2-tier using any language on your laptop PHP, Ruby, perl, .net, Java, whatever.

Code: Select all

   // share my ibm_db2 connection either persistent or full open/close
   if ($i5persistentconnect) $conn = db2_pconnect($database,$user,$password);
   else $conn = db2_connect($database,$user,$password);

  // route location to same job on IBM i, known as IPC or internalKey (also known as state full)
  // if IPC missing you just use temp job with no recall of xmlservice when script ends (stateless)  
   $internalKey = '/tmp/packers';

   // toolkit calling same job as regular old ibm_db2 
   try { $ToolkitServiceObj = ToolkitService::getInstance($conn); }  catch (Exception $e) { die($e->getMessage()); }
   $ToolkitServiceObj->setToolkitServiceParams(array('InternalKey'=>$internalKey, 'plug'=>"iPLUG32K"));

  // reuse connection call from ibm_db2 (same code stuff inside Toolkit)
  $stmt = db2_prepare($conn, "call $libxmlservice.iPLUG65K(?,?,?,?)");
  $ipc = $internalKey;  // same job as Toolkit above
  $ctl = '*sbmjob';
  $clobIn = getxml();
  $clobOut = "";
  $ret=db2_bind_param($stmt, 1, "ipc", DB2_PARAM_IN);
  $ret=db2_bind_param($stmt, 2, "ctl", DB2_PARAM_IN);
  $ret=db2_bind_param($stmt, 3, "clobIn", DB2_PARAM_IN);
  $ret=db2_bind_param($stmt, 4, "clobOut", DB2_PARAM_OUT);

  // reuse the same DB2 connection for a query
  $result = db2_exec($conn,"select * from animals");

Posts: 874
Joined: Thu Apr 09, 2009 5:45 pm

Re: "How to" DS Array (AddDataStruct)

Post by aseiden » Mon Dec 03, 2012 9:45 am


I've created a beta update to the toolkit that will allow arrays of data structures. I'm in the process of uploading it. I can give you a special link if you want.

Please post the PHP code you've tried to use with DS arrays. I'll use that to create a correct script to handle the arrays, which I'll post.

Best regards,

Post Reply