RTVNETA with CLCommandWithOutput()

Post Reply
rich8182
Posts: 4
Joined: Mon May 02, 2016 3:53 pm

RTVNETA with CLCommandWithOutput()

Post by rich8182 » Mon May 02, 2016 4:05 pm

Why does RTVNETA give me an internal server error? (500)

If I start with the demo code from Alan's presentation and call RTVJOBA, everything returns correctly.

Code: Select all

function getJobAttributes() {  
    // Note: specify (?N) for numeric attributes 
    $cmdString = 'RTVJOBA JOB(?) USER(?) NBR(?) CURUSER(?) SYSLIBL(?) 
CURLIB(?) USRLIBL(?) LANGID(?) CNTRYID(?) CCSID(?N) DFTCCSID(?N)';
    // Send command; get output array of key/value pairs 
    $outputArray = $this->ClCommandWithOutput($cmdString);
    return $outputArray; 
} //(public function getJobAttributes())  
$attrs = $tkitConn->getJobAttributes(); // run command  
echo '<pre>' . print_r($attrs, true) . '</pre>'; // print_r() formats arrays
I get the return I expect

If I edit that code to the following:

Code: Select all

function getNetworkAttributes() {
    // Note: specify (?N) for numeric attributes
    $cmdString = 'RTVNETA SYSNAME(?)';
    // Send command; get output array of key/value pairs
    $outputArray = $this->ClCommandWithOutput($cmdString);
    return $outputArray;
} //(public function getNetworkAttributes())
$attrs = $tkitConn->getNetworkAttributes(); // run command
echo '<pre>' . print_r($attrs, true) . '</pre>'; // print_r() formats arrays
returns a 500 Internal Server Error

scottgcampbell
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: RTVNETA with CLCommandWithOutput()

Post by scottgcampbell » Mon May 02, 2016 6:28 pm

Not sure where you are adding your function but getJobAttributes is in ToolkitService.php, so you would have to add it there or that would be the likely cause of the 500 error. If you want to do it without modifying ToolkitService.php you could use:

Code: Select all


    $cmdString = 'RTVNETA SYSNAME(?)';
    // Send command; get output array of key/value pairs
    $attrs = $tkitConn->ClCommandWithOutput($cmdString);
Assuming that $tkitConn exits. (Tested the code and it worked for me)

Scott

rich8182
Posts: 4
Joined: Mon May 02, 2016 3:53 pm

Re: RTVNETA with CLCommandWithOutput()

Post by rich8182 » Tue May 03, 2016 1:40 pm

Thanks a ton!

That worked perfectly. I was taking the same getJobAttributes() function from the example and just updating it to use RTVNETA. Same test page, just rename and edit the function.

Calling RTVNETA directly as the input to ClCommandWithOutput instead of wrapping the call inside a function first returns what I'm looking for.

Thanks again.

Post Reply