Page 2 of 3

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Thu May 28, 2015 6:41 pm
by shelfos
I seem to be having the same issue but I haven't been able to resolve it.

I don't have the authorization.php file but isn't that just for testing purposes anyway or do I always need it for the GetSPLF? I haven't required it in my code, but if I do need it then I am not sure where to get it - the link above doesn't seem to point me to the right place.

I also implemented Alan's fix to the ReadSPLFData() function to make sure the schema separator is correct.

In iToolkitService.php the GetSPLF function runs (correctly) all the way up through the ReadSPLFData() function call. In that function the executeQuery() function runs (from ToolkitService.php which is actually calling the executeQuery function in Db2supp.php). This is where I get the failure. Even though the spooled file was successfully copied to the temporary table, for some reason the db2_fetch_row returns 0 rows. I get the same error as the OP.

Through trial and error I've narrowed it down to the db2_fetch_row being executed but returning 0 rows. Both my user credentials and QTMHHTTP have *ALL authority to the temporary table that holds the results of the spooled file copy command.

We recently upgraded to Zend Server 8, but in the previous version the GetSPLF function was working just fine for us.

What am I missing?

I noticed the OP was going to submit a ticket. Is there a link to the ticket so I can check the status?

Thanks for your help (please, anyone).

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Thu May 28, 2015 7:32 pm
by scottgcampbell
If you look in iToolkitService.php in the GetSPLF function it creates a copy of ZSF255 into the TmpLib library, QGPL by default. Try commenting out the DLTF command at the end of the function and then check the file to see if it was created and if it has anything in it. then you can try logging some of the commands in the function to see what they are and try running them manually to see if you can determine which part is failing. I've got customizations in both the ReadSPLFData function and i5_spool_get_data (in cw.php) to get them to work on our system.

Let us know what you find.

Scott

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Thu May 28, 2015 7:44 pm
by shelfos
Thanks Scott,

Every command works when done manually, including the DLTF.

If I stop processing before the DLTF command the file exists and I can query it directly and there are rows.

The $stmt variable (in the Db2supp.php executeQuery() function) is a resource type so the db2_exec function isn't encountering an error, but for some reason the db2_fetch_row returns 0 results.

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Thu May 28, 2015 8:07 pm
by scottgcampbell
What does the SQL that it is executing look like, does it have the correct separator and library and file? You could try adding a db2_prepare into executeQuery in Db2supp.php and see if it works.... (hard to do remote debugging :) )

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Thu May 28, 2015 8:42 pm
by shelfos

Code: Select all

SELECT ZSF255 FROM QGPL.PGMR9301 FOR FETCH ONLY;

Code: Select all

SELECT ZSF255 FROM QGPL/PGMR9301 FOR FETCH ONLY;

When running either of them using Db2supp.php db2_exec() I get 0 results.

What's weird is if I use db2_execute() to run either query I also get 0 results. But if I use STRSQL (old green screen) I DO get results (logged in as PGMR9301). Any way I try using php I have no success, but I don't seem to be getting any errors per se. I've checked permissions and QTMHTTP has *ALL object authority (as does PGMR9301).

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Fri May 29, 2015 4:00 am
by aseiden
To be clear, you authenticated to the toolkit as PGMR9301, right? (QTMHHTTP won't matter)

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Fri May 29, 2015 4:51 pm
by scottgcampbell
Do any queries work through db2supp executeQuery?

I just tried this and it worked

Code: Select all

$out = $ToolkitServiceObj->executeQuery( "select count(*) from QSYS2.syscolumns" );
var_dump($out);
Returns:
array(1) {
[0]=>
int(538961)
}

So if you aren't getting anything back perhaps that is where the issue is, and if you are then .... ???

Scott

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Fri May 29, 2015 5:19 pm
by shelfos
That was a great idea to try to narrow this down.

I do get results for the qsys2.syscolumns query.

I am authenticating the toolkit at PGMR9301

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Fri May 29, 2015 5:39 pm
by scottgcampbell
Ok,

Check what file is being created/copied to:

Code: Select all

// delete temp file
$dltf   = "DLTF FILE($this->TmpLib/$this->TMPFName)";
// Add this in GetSPLF - echo or log it somehow
echo $dltf;
Or explicitly pass a name for it to use, and comment out the delete, then check if that file (which is not ZSF255 - unless you are passing that in as a parm) has anything in it and has the correct permissions.

Scott

Re: GetSPLF failing to perform the CPYSPLF function

Posted: Fri May 29, 2015 6:33 pm
by shelfos
The file being created is QGPL/PGMR9301.

These are the file permissions (PGMR9301 is part of the BMAPGMR group):

Code: Select all

                         Object  
User        Group       Authority
*PUBLIC                 *USE     
*GROUP      BANK93      *ALL     
*GROUP      BMAPGMR     *ALL     
MICR                    *ALL     
QPGMR                   *ALL     
QTCP                    *ALL     
QTMHHTTP                *ALL     
ZENDADMIN               *ALL     
If I use STRSQL or iSeries Navigator to perform the sql query (using PGMR9301), I get results.

Although, I do notice something interesting when doing it from iSeries Navigator. The data looks like jibberish unless I select the "Translate CCSID 65535" checkbox in the "Translation" tab.