Results 1 to 3 of 3

Thread: Calling a iSeries(AS400) CL --RESOLVED--

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    40

    Calling a iSeries(AS400) CL --RESOLVED--

    folks,

    was following a MS example on how to call a as400CL using OLE.
    My code:



    Dim ConnString As String
    ConnString = "Provider=IBMDA400; Data Source=AS01DEV; User ID=TJYASNOW; Password=ALICE1;"

    Dim myConnection As New OleDb.OleDbConnection
    myConnection.ConnectionString = ConnString

    Dim myCommand As New OleDb.OleDbCommand("CALL TESTTOM.SWAPSTR(?,?)", myConnection)
    myCommand.CommandType = CommandType.Text

    'setup the parameters
    Dim myParameter As New OleDb.OleDbParameter("param1", OleDb.OleDbType.Char, 10)
    myParameter.Value = "String1"
    myParameter.Direction = ParameterDirection.InputOutput
    myCommand.Parameters.Add(myParameter)

    Dim myParameter2 As New OleDb.OleDbParameter("param2", OleDb.OleDbType.Char, 10)
    myParameter2.Value = "String2"
    myParameter2.Direction = ParameterDirection.InputOutput
    myCommand.Parameters.Add(myParameter2)

    'execute
    Dim results As String
    myConnection.Open()
    myCommand.ExecuteNonQuery()

    myConnection.Close()
    results = myParameter2.Value


    I get this error:

    Server Error in '/AS400Play' Application.
    --------------------------------------------------------------------------------

    SQL7985: CALL statement complete. Cause . . . . . : Call to procedure SWAPSTR completed successfully.



    And the return parm is unchanged. Should be swapped with Param1

    The NET side seems to think a successfull call is an error.
    On the AS400 side the object has been executed because the OS
    tracks it.

    Any suggestions?
    Last edited by Tom Yaz; Feb 12th, 2004 at 07:35 AM.

  2. #2
    Addicted Member MasterBlaster's Avatar
    Join Date
    Jul 2002
    Location
    Seattle
    Posts
    196
    It's been a while since I used an iseries but make sure that the parameter is set up as an i/o parameter in you as400CL. not just an i or an o param.
    "And most of the evils of society can, in fact, be cured through information. We have a society that has been disinformed and based on the disinformation has made irrational choices. And that's what I mean by 'ignorance.' People, who ordinarily might be smart, are deprived of the data by which to make a rational decision, don't have the data to do it."
    Frank Zappa

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    40

    Screw OLEDB

    Found out from a expert in iseries that IBM's OLE provider for iSeries is buggy. He had the same problem. Used the ODBC provider instead and basically wrote the same code. Worked fine. So now I can make a call to a iseries box pass parms back and forth, execute whatever programs on the iSeries. Way cool. With this I could visulaize .NET being the "front end" app while the iseries doing all the "heavy lifting"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width