Focal Point
SQL Passthough problem

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6277091606

June 29, 2011, 11:13 AM
bobjackson
SQL Passthough problem
We have WebFOCUS running on an iSeries reporting server which has a passthough connection to a second iSeries. I see these as configured DB2 Cli adapters *LOCAL and AG12.

I'm trying to retrieve 2 sets of data from AG12 using stored procedures. Here's my code

SQL DB2 SET DEFAULT_CONNECTION AG12

SQL DB2 EX AGPRDDTA/USA_WF_11_13_RETRIEVE_BRANCHES(NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-RUN

TABLE FILE SQLOUT
PRINT *
IF READLIMIT EQ 5
END
-RUN

SQL DB2 EX AGPRDDTA/USA_WF_11_13_RETRIEVE_DEPT_CAT(NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-RUN

TABLE FILE SQLOUT
PRINT *
IF READLIMIT EQ 5
END
-RUN

I get 5 records from the first enquiry but messages
< !--
(FOC1400) SQLCODE IS -501 (HEX: FFFFFE0B)
: [24501] Cursor SQLCURSOR000000002 not open.
(FOC1407) SQL FETCH CURSOR ERROR. : SQLOUT
-->
from the second.

If I swap the two calls around, I still get 5 from the first and an error on the second.

It looks like I need a piece of syntax to close the first enquiry down.

I've been trying all afternoon - anyone with any ideas please?


WebFocus 7.6.11
IBM iSeries
June 29, 2011, 11:36 AM
MCKELPA99
Try adding an 'END' before the '-RUN' in each of your stored procedure calls:

SQL DB2 EX AGPRDDTA/USA_WF_11_13_RETRIEVE_BRANCHES(NULL,NULL,NULL,NULL,NULL,NULL,NULL);
END
-RUN


WebFOCUS 7.7.02
Unix
All Output
June 29, 2011, 12:39 PM
Francis Mariani
None of the SQL passthrough requests in my archive have an END between the SQL command and the TABLE FILE SQLOUT command - they are really part of one SQL passthrough statement.

To eliminate possible problems with the procedure AGPRDDTA, have you tried a simple SQL passthrough request, something like:

SQL DB2 SET DEFAULT_CONNECTION AG12
SQL DB2
SELECT
SYSCAT.TABLES.TABSCHEMA
FROM
SYSCAT.TABLES
FETCH FIRST 10 ROWS ONLY;
TABLE FILE SQLOUT
PRINT *
END

There are two iseries computers involved, which suggests a remote connection, and that may different syntax...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 29, 2011, 01:39 PM
bobjackson
Hi

Thanks for the 2 replies

We've been trying all sorts of things this afternoon and a colleague of mine has resolved this, simply by removing the "-RUN"s that occur immediately after the SQL.

See the following with the *RUN commented out.

Note that the original code all worked where the data was on the same machine as reporting server, it was only when passing through that the second and subsequent SQL calls gave the error.


SQL DB2 SET DEFAULT_CONNECTION AG12

SQL DB2 EX AGPRDDTA/USA_WF_11_13_RETRIEVE_BRANCHES(NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-* -RUN

TABLE FILE SQLOUT
PRINT *
IF READLIMIT EQ 5
END
-RUN

SQL DB2 EX AGPRDDTA/USA_WF_11_13_RETRIEVE_DEPT_CAT(NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-* -RUN

TABLE FILE SQLOUT
PRINT *
IF READLIMIT EQ 5
END
-RUN


WebFocus 7.6.11
IBM iSeries