Skip to content

Instantly share code, notes, and snippets.

@chukShirley
Created October 8, 2014 13:11
Show Gist options
  • Save chukShirley/f67f1b56f78036ee08cf to your computer and use it in GitHub Desktop.
Save chukShirley/f67f1b56f78036ee08cf to your computer and use it in GitHub Desktop.
Using PHP Toolkit for IBM i to call CL program
// Instantiate toolkit object
try{
$ToolkitServiceObj = ToolkitService::getInstance($db, $namingMode);
}
catch (Exception $e) {
echo $e->getMessage(), "\n";
exit();
}
$ToolkitServiceObj->setToolkitServiceParams(array('InternalKey'=>"/tmp/$user",
'debug'=>true,
'plug' => "iPLUG32K"));
// Add parameters
$param[] = $ToolkitServiceObj->AddParameterChar('both', 1, 'yard', 'yard', $yard);
$param[] = $ToolkitServiceObj->AddParameterPackDec('both',9,0,'SRN','SRN',$srn);
$param[] = $ToolkitServiceObj->AddParameterChar('both', 10, 'outq', 'outq', $purch_outq);
// Call the program
$result = $ToolkitServiceObj->PgmCall("SC0003CL", "SSC", $param, null, null);
if($result){
// Yay! The CL program returned a result! Do other stuff here...
} else {
// Boo! The CL program didn't return a result. Error handling goes here...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment