I need to accomplish the following:
-
Create a stored procedure on DB2/400 that returns a resultset. No input or output parameters are needed.
-
Call this stored procedure from LotusScript
-
Manipulate the resultset
I managed to piece together enough from the “DB2 Stored Procedures and Triggers” RedBook to use the Run SQL utility from Operations Navigator and create the stored procedure. However, when I try to execute it via LCLSX calls I get the error “Metadata object does not exist”. I gave (Public) full permissions and even tried using my own account but I get the same error regardless. I think the problem is something on the iSeries server that I’m missing, but I have no idea what.
In case it does matter, below is my code. The client is Windows 2000 SP4 with ND 6.5.1 and the server is OS/400 V5R2 with ND 6.5. If anyone can offer any assistance I would appreciate it tremendously.
Thanks,
Charles
P.S. For those who may tell me to post this in the Enterprise Integration forum, I did that several days ago and have not received any response.
Dim lcSession As LCSession
Dim lcConn As LCConnection
Dim lcFields As LCFieldList
Set lcSession = New LCSession
lcSession.ConnectionPooling = True
Set lcConn = New LCConnection("odbc2")
With lcConn
.Server = "LOCAL"
.UserID = "user"
.Password = "pass"
End With
Call lcConn.Connect
If Not lcConn.IsConnected Then
Messagebox "Error: Unable to connect."
Exit Sub
End If
'WMBIRD is the library, SALESSUM is the stored proc name
Set lcFields = New LCFieldList
If lcConn.Execute("CALL WMBIRD.SALESSUM()", lcFields) Then
If lcConn.Fetch(lcFields, 1, 1) > 0 Then
Print lcFields.Lookup("CLCODE").Text(0)
End If
End If
Call lcConn.Disconnect
Set lcConn = Nothing
Set lcFields = Nothing
Set lcSession = Nothing