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

The CLCommand Method

CL Command Execution Method

There are several methods to call a command:

  1. CLInteractiveCommand – Returns screen output from a command.

    1. $output = $obj->CLInteractiveCommand($Command);

  2. CLcommand – Returns only a boolean success flag from a command. Fastest way to run a command.

    1. $success = $obj->CLCommand($Command)

  3. ClCommandWithOutput – Returns output parameters from commands that have output parameters. Decimal parameters require (?N) rather than (?) in command string.

    1. $cmd = 'RTVJOBA JOB(?) USER(?) NBR(?) CURUSER(?) DFTCCSID(?N)';
      $output = $obj->CLCommandWithOutput($cmd);

 

Arguments

Value

Description

$Command

 

Valid CL command string

Sample Code

This sample shows how to run the following CL commands:

Usage Example

</pre>
<?php
include_once 'authorization.php';
include_once '../API/ToolkitService.php';

     try {
         $obj = ToolkitService::getInstance($db, $user, $pass);
     }
     catch (Exception $e) {              
        echo  $e->getMessage(), "\n";
        exit();
    }

    $obj->setToolkitServiceParams(array('InternalKey'=>"/tmp/$user",                                         'debug'=>false,                                         'plug' => "iPLUG32K"));
    $cmd = "addlible ZENDSVR";
    $obj->CLCommand($cmd);
    echo "<pre>";  
    $Rows = $obj->CLInteractiveCommand("DSPLIBL");
    /*$Rows = $obj->CLInteractiveCommand("WRKSYSVAL OUTPUT(*PRINT)");*/
    if(!$Rows )
        echo $obj->getLastError();
    else       
      var_dump($Rows);

    echo "</pre>";  

?>

 

 

Read Also

  PHP XMLSERVICE Toolkit    
  Toolkit Service Class