API Reference Guide > PHP XMLSERVICE Toolkit > Toolkit Service Class > The PGMCall Method

The PGMCall Method

Program Call Method

The program call method allows calling program (*PGM) or service program (*SRVPGM). (Not a *MODULE, which is a non-runnable intermediate object).

PgmCall($Program, $Library, $Parameters, $Returnvalue, $options)

 

Arguments

Value

Description

$Program

  •  Program name
  • *OFF
  • *NONE

Program name to be called

$Library

Library name (or blank to use library list)

Library where the program is located

$Parameters

See parameters section

Program  parameters

$Returnvalue

 

Program return value parameter definition, to define what sort of value will be returned by a subprocedure or function.

$options

An array of options

A popular option is to provide a service program function name: 'func' => 'myfuncname' Function name is case-sensitive.

Sample Code

This sample shows how to run an RPG program that has the following parameters:

Usage Example

<?php
  
include_once 'authorization.php';
include_once '../API/ToolkitService.php';
include_once 'helpshow.php';
$extension='ibm_db2';  
try {
    $ToolkitServiceObj = ToolkitService::getInstance($db, $user, $pass, $extension);
    }
    catch (Exception $e)
    {              
        echo  $e->getMessage(), "\n";
        exit();
    }
   
$ToolkitServiceObj->setToolkitServiceParams(array('InternalKey'=>"/tmp/$user"));
$code = ‘1’;;
$desc = ' ';
     
$param[] = $ToolkitServiceObj->AddParameterChar('both', 10,'InventoryCode', 'code',
$code);
$param[] = $ToolkitServiceObj->AddParameterChar('both', 10,'Description', 'desc',
$desc);
$result = $ToolkitServiceObj->PgmCall("COMMONPGM", "ZENDSVR", $param, null, null);
if($result){
  showTable( $result['io_param']);
}
else
    echo "Execution failed.";
     
/* Do not use the disconnect() function for "state full" connection */
$ToolkitServiceObj->disconnect();
?>

 

 

Read Also

  PHP XMLSERVICE Toolkit    
  Toolkit Service Class