Focal Point
How to Execute a Stored Procedure with Multiple Amper Variables

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

October 24, 2007, 12:32 PM
<Heather>
How to Execute a Stored Procedure with Multiple Amper Variables
I am currently working in the MRE environment on Webfocus 5.33. My code is as follows:

-MRNOEDIT BEGIN

REMOTE DEST = WFSA2003
-REMOTE BEGIN

SQL SQLMSS SET SERVER STTOPC01
END
SQL SQLMSS

ex gm_Report_DowntimeExcelReport_GetIncidentsByStartDate_TimeandEndDate_Time '&StartDate_Time','&EndDate_Time';

TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS LISTOWOS
END
-REMOTE END

TABLE FILE LISTOWOS
PRINT *
END

-MRNOEDIT END

I get the following error message

No HTML Output!

--------------------------------------------------------------------------------


(FOC1671) SET SERVER STTOPC01 COMMAND FOR SQLMSS INTERFACE OUT OF SEQUENCE
(FOC1671) SET SERVER STTOPC01 COMMAND FOR SQLMSS INTERFACE OUT OF SEQUENCE
(FOC1400) SQLCODE IS 2812 (HEX: 00000AFC) XOPEN: 42000
: Microsoft OLE DB Provider for SQL Server: [42000] Could not find stored
: procedure 'gm_Report_DowntimeExcelReport_GetIncidentsByStartDate_Timeand
: EndDate_Time'.
L (FOC1405) SQL PREPARE ERROR.
(FOC1400) SQLCODE IS 1671 (HEX: 00000687)
: SET SERVER STTOPC01 COMMAND FOR SQLMSS INTERFACE OUT OF SEQUENCE
L (FOC1405) SQL PREPARE ERROR.
0 ERROR AT OR NEAR LINE 21 IN PROCEDURE sqlstoreFOCEXEC *
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: LISTOWOS
BYPASSING TO END OF COMMAND

I am getting prompted for the StartDate_Time and EndDate_Time so why would I get the message thatit can't find the stored procedure. So how do I point this stored procedure to the right database on the sql server? Also, at the beginning of the stored procedure it defines the date fields as follows:
--DECLARE @StartDate_Time SMALLDATETIME
--DECLARE @EndDate_Time SMALLDATETIME
--DECLARE @OPID TINYINT
--SET @StartDate_Time = '9/20/2004'
--SET @EndDate_Time = '9/23/2004'

Any help or suggestion would be appreciated.
October 24, 2007, 02:55 PM
Carol Dobson
Here's the syntax I use....

ENGINE SQLMSS SET CONVERSION LONGCHAR ALPHA
ENGINE SQLMSS SET DATETIME OFF
ENGINE SQLMSS SET SERVER &DataConnection
SQL SQLMSS EX SelAffirmationUK &IssuerID, &RAID, &PMID, &CompanyID , '&Affirmed', '&DebtClass', &TableID ;


Hope this helps!



WebFOCUS 7.6.6/TomCat/Win2k3
October 25, 2007, 10:25 AM
<Heather>
Carol, thanks for your example but it still doesn't work. If I explain our environment, maybe the proper syntax will surface from that.

The environment is that there is a webserver (5.3.3) that talks to the reporting server (EDA533P) which talks to the sql adaptor which is mapped to the SQL server. The stored procedure resides on the SQL server and we don't have the proper statements to tell Focus where that procedure is so it can't execute it.
October 25, 2007, 10:40 AM
<Heather>
quote:
Originally posted by Tom Flynn:
Heather,

I did a GOOGLE search on stored procedure variables, found this:

Global Variables and Stored Procedure Parameters

Hope it helps, until, someone with more knowledge comes along...


Thanks Tom, this will come in handy once I get the proper syntax working.

Heather
October 25, 2007, 10:58 AM
Kamesh
Couple of things,

1. Is the connection name STTOPC1 exists? If exists, which database it points?

2. Do you have the stored procedure in the database where it points?

Check those and let me know if you still have a issue.

When you say you are getting prompted to enter STARTDATE and ENDDATE, that is because those are dialogure manager variable and it doesn't mean SP exists when it prompted.


WFConsultant

WF 8105M on Win7/Tomcat
October 25, 2007, 11:15 AM
<Heather>
Kamesh,

1. Yes the connection STTOPC01 exists. It doesn't point to a default database because the user name and password has admin rights to all databases on the server.
2. The stored procedure resides in the database called ShiftLogReporting.

Thnaks
Heather
October 25, 2007, 11:21 AM
Kamesh
Try this,


ex ShiftLogReporting.userid.gm_Report_DowntimeExcelReport_GetIncidentsByStartDate_TimeandEndDate_Time '&StartDate_Time','&EndDate_Time';

userid - It depends on who have the access.

example: dbo or any user.

It should work. If not try run this in query analyzer and see whether it returns you data or not.

Hope this helps,


WFConsultant

WF 8105M on Win7/Tomcat
October 25, 2007, 01:17 PM
<Heather>
It runs in Query analyzer but not on the web.

Is there a character limit in the MRE environment for a stored procedure name by chance?

This message has been edited. Last edited by: <Heather>,
October 25, 2007, 01:38 PM
Kamesh
Instead of calling that Stored Procedure, can you try calling a simple table in that database?

your query will be select top 10 * from tablename;

Somewhat I feel it's not able to connect to that database.


WFConsultant

WF 8105M on Win7/Tomcat
October 25, 2007, 03:07 PM
ira
try putting an an END after your ex line and before the TABLE FILE SQLOUT. Had similar error/problem once upon a time and then the problem went away with that fix.

Let me know.

Ira
WF 5.3.6 AIX


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
October 26, 2007, 03:10 AM
Ingas
Hi Heather,

Try to use [dbname].[creator name].[sp_name] format.
(Three-part format)

Link to sqldts.com is indeed useful - but not in your case.

I suppose that default database for WF Login is another than for login you use with SQL Analyzer.
(So you're in different DBs when you're in WF and isqlw)


WF 7.6.2, WinNT/2K, MSSQL 2K, MSOLAP 2K, BID
October 26, 2007, 06:33 AM
<Heather>
Thanks Ira, but it didn't work.
October 26, 2007, 01:28 PM
Jason K.
could you change your code to a simple select statement? that will rule out a LOT of possibilities.

quote:
-MRNOEDIT BEGIN

REMOTE DEST = WFSA2003
-REMOTE BEGIN

SQL SQLMSS SET SERVER STTOPC01
END
SQL SQLMSS

ex
'remove from here
gm_Report_DowntimeExcelReport_GetIncidentsByStartDate_TimeandEndDate_Time '&StartDate_Time','&EndDate_Time';
'to here and put in
select * from dbo.someschema.sometable;
'change the schema and table name to something you know exists. It's been a while since I've worked with ms sql, not sure if the dbo. goes first or after schema

TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS LISTOWOS
END
-REMOTE END

TABLE FILE LISTOWOS
PRINT *
END

-MRNOEDIT END



Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
October 26, 2007, 05:30 PM
N.Selph
I know it seems crazy, but have you tried:
ON TABLE PCHOLD AS LISTOWOS

When you are in a HUB-SUB situation, and using -REMOTE to bypass the HUB server, to get your answer set held on the HUB (not the SUB), you need to use PCHOLD.

This message has been edited. Last edited by: N.Selph,


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
October 29, 2007, 09:45 AM
GamP
Heather,
Have you looked at thisarticle?
It states that the first MSSQL connector mentioned in the edasprof (on your subserver WFSA2003) should have (access to) the stored procedure.
Does this help?


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
October 29, 2007, 12:50 PM
<Heather>
It was a nice try but it didn't work.
October 29, 2007, 01:04 PM
<Heather>
Using this code, my query runs but returns the column names only. I should have 54 records.

-MRNOEDIT BEGIN

SQL EDA SET SERVER WFSA2003

-REMOTE BEGIN

ENGINE SQLMSS SET DEFAULT_CONNECTION STTOPC01
SQL SQLMSS

SELECT

IssueId,
IssueDesc

FROM ShiftLogReporting.dbo.InspectionIssuesList;

TABLE FILE SQLOUT
PRINT *
ON TABLE PCHOLD AS LISTOWOS
END

-REMOTE END

TABLE FILE LISTOWOS
PRINT *
END

-MRNOEDIT END
October 29, 2007, 01:55 PM
hammo1j
Heather

It sounds like the userid/password combination in the connection string does not have privilege to access the table. For security reasons you do not get a message just 0 records.

Remember that your original stored procedures can run with extra privileges on top of those granted to a user to SELECT.

Try running the SELECT statement (NOT the Stored Procedure) from Enterprise manager with the EXACT connection string you use and you prob will find 0 records retrieved.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo