Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Looping Multiple SQL Stored Procedure Requests

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Looping Multiple SQL Stored Procedure Requests
 Login/Join
 
Gold member
posted
Hi, I am wondering if anyone has run into this problem. I need to execute a SQL stored procedure multiple times and am running into some problems. Basically, after my first loop, any subsequent loop runs into a conflict with "SQLOUT". (This is the error: "(FOC1400) SQLCODE IS 49 (HEX: 00000031) : ct_options(): user api layer: external error: This routine cannot be called because another command structure has results pending.") Basically, the procedure seems to fail to create a new SQLOUT hold because SQLOUT is still active from the first pass. I have gotten around this before by renaming the targeted the output (for example, "PREPARE SQLOUT2 FOR") but the prepare statement doesn't seem to work with the called stored procedure.

I'm just throwing this out there in case anyone has some ideas.

Thanks,

Debbie Sullivan
 
Posts: 52 | Location: Merrimack, NH | Registered: August 17, 2006Report This Post
Expert
posted Hide Post
Do you have -RUN between your requests?

If not, the problem you're getting may have something to do with the FOCUS stack...


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Yep. I always use -RUN.
 
Posts: 52 | Location: Merrimack, NH | Registered: August 17, 2006Report This Post
Expert
posted Hide Post
Deborah, I did a quick test, and this works in my DB2 environment:

SET SQLENGINE=DB2
-RUN

SQL
SELECT T1.REP_CD,T1.REP_DS FROM EQP.EQ_REP T1 FETCH FIRST 5 ROWS ONLY FOR FETCH ONLY;
TABLEF FILE SQLOUT
PRINT 
REP_CD
REP_DS
ON TABLE HOLD AS H001 FORMAT ALPHA
END
-RUN

SQL
SELECT T1.REP_CD,T1.REP_DS FROM EQP.EQ_REP T1 FETCH FIRST 10 ROWS ONLY FOR FETCH ONLY;
TABLEF FILE SQLOUT
PRINT 
REP_CD
REP_DS
ON TABLE HOLD AS H002 FORMAT ALPHA
END
-RUN

SQL
SELECT T1.REP_CD,T1.REP_DS FROM EQP.EQ_REP T1 FETCH FIRST 20 ROWS ONLY FOR FETCH ONLY;
TABLEF FILE SQLOUT
PRINT 
REP_CD
REP_DS
ON TABLE HOLD AS H002 FORMAT ALPHA
END
-RUN


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Sorry, the previous posting may not be addressing the "stored procedure" issue.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
<RickW>
posted
If you know approx. how long the proc runs, you could create a countdown timer with DM as part of your loop logic - or - use ReportCaster and flag completion files.

Food for thought Smiler
 
Report This Post
Platinum Member
posted Hide Post
My first inclination would be towards Francis' solution above. You could have a dynamic naming variable for the Hold-file (in a loop if needed).
-*
-SET &HCNT=&HCNT + 1;
SQL DB2
SELECT
...
ON TABLE HOLD AS HOLD&HCNT..F
END
-* (gives you HOLD1F, HOLD2F, HOLD3F, etc.)
-*
If that does not work with Stored Procedures, you could try flushing out the SQLOUT to a hold file and then get back to the next S.P.

Intriguing Q anyway Debbie. Please post back as to what eventually worked.

Sandeep Mamidenna


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Deborah,

That message is normally due to the fact that the recordset returned from the stored proc has not been accessed and therefore the post from Francis is probably mostly on the money in as much that you need to issue a table request against your SP recordset before calling your SP again.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Looping Multiple SQL Stored Procedure Requests

Copyright © 1996-2020 Information Builders