Hello Guru’s
I am a little new to calling stored procedures with Lotus Script; however I have had many successes with LSXLC connections to our iSeries DB400 files.
I am struggling with the same erroneous generic error message… Agent ‘Update iSeries Orders’ error: Error: Stored procedure is invalid or parameter names are incorrect., Connector ‘db2’, Method -Call- (12325)
This is the statement it bombs on: out = gLCDb2Con.Call (input_fieldlist, 1, output_parms)
Here is a sample of my code
**** Options ****
Option Public
Option Declare
Use “Globals”
Uselsx “*lsxlc”
****Declarations ****
'---------- LotusScript Extension for Lotus Connectors (LSX:LC) classes --------
Dim gLCSession As LCSession
Dim gLCDb2Con As LCConnection
Dim gLCNotesCon As LCConnection
Dim gLCDb2FieldList As LCFieldList
Dim gLCNotesFieldList As LCFieldList
'------------------ End of LSX:LC ------------------
Dim gGlobalView As NotesView
Dim gGlobalDoc As NotesDocument
Dim gAgentLog As NotesLog
Dim gMsg As String
'--------------------- Stored Procedure Parameters --------------
Dim input_parameters As LCFieldList
Dim output_parameters As LCFieldList
Dim parm As LCField
**** Initalize *****
Sub Initialize
Dim gLCSession As New LCSession
Dim gLCDb2Con As New LCConnection ("db2")
' Set all classes
Set gLCSession = New LCSession
Set gLCDb2Con = New LCConnection ( "db2" )
Set gLCNotesCon = New LCConnection ( "notes" )
Set gLCDb2FieldList = New LCFieldList
Set gLCNotesFieldList = New LCFieldList
' Establish a connection to DB2
gLCDb2Con.Database = "NWF820"
gLCDb2Con.UserID = "domconn"
gLCDb2Con.Password = "domconn"
'gLCDB2Con.Metadata = gGlobalDoc.PutTable(0)
'connect to the database...
gLCDb2Con.Connect
'set the stored procedure owner. If needed
'conn.Owner = "DB2ADMIN"
'set the stored procedure name...
gLCDb2Con.Procedure = "NWFO.ORDNUMRTV"
'set Fieldnames property with any output parameters declared in the stored procedure...
gLCDb2Con.Fieldnames = "Number"
'declare any fields and fieldlists for input/output data...
Dim input_fieldlist As New LCFieldList
Dim output_parms As New LCFieldlist
Dim in_field As New LCField (1, LCTYPE_TEXT)
Dim number As New LCField (1, LCTYPE_TEXT)
Dim out As Double
'set the input parameters of the stored procedure...
Set in_field = input_fieldlist.Append ("LOCATION", LCTYPE_TEXT)
in_field.Value = "020"
Print "Your parms are " & in_field.value(0)
Set in_field = input_fieldlist.Append ("XDIV", LCTYPE_TEXT)
in_field.Value = "S"
Print "Your parms are " & in_field.value(0)
'Set in_field = input_fieldlist.Append ("QTY", LCTYPE_INT)
'in_field.Value = 500
'with the input parameters set, call the stored procedure...
'the declared output_parms fieldlist will hold the output parameters of the stored procedure...
out = gLCDb2Con.Call (input_fieldlist, 1, output_parms)
'fetch parameter(s) into the output_parms fieldlist...
out = gLCDb2Con.Fetch (output_parms)
'retrieve the parameter(s) from the output_parms fieldlist...
Set number = output_parms.GetField (1)
'use the output parameter value(s) in your script...
Print "Your new sales order number is " & number.Value(0)
gLCDb2Con.Disconnect
End Sub