Tags: ado, application, as400, aspnet, call, calling, continue, error, following, net, program, rpg

Problem calling an AS400 program from ASP.NET

On .Net » .Net ADO

4,063 words with 3 Comments; publish: Sat, 05 Jan 2008 08:25:00 GMT; (10078.13, « »)

I am trying to call an RPG (AS400) program from a VB.Net application and continue to get the following error message:

IBM.Data.DB2.iSeries.iDB2SQLErrorException

SQL0204 OPS010 in type *N not found.

at IBM.Data.DB2.iSeries.iDB2Exception.throwDcException(MpDcErrorInfo mpEI, MPConnection conn)

at IBM.Data.DB2.iSeries.iDB2Command.reportDCError(Int32 rc)

at IBM.Data.DB2.iSeries.iDB2Command.Prepare()

at IBM.Data.DB2.iSeries.iDB2Command.ExecuteScalar()

My code is listed below. Any help on this would be greatly appreciated.

prgCmdDB2.Connection = cn2DB2

prgCmdDB2.CommandType = CommandType.Text

prgCmdDB2.CommandText = "CALL OPS010(?,?,?,?,?,?)"

Dim parCompany As IBM.Data.DB2.iSeries.iDB2Parameter = New IBM.Data.DB2.iSeries.iDB2Parameter

parCompany.ParameterName = "Company"

parCompany.Value = dr.Item("O1CMPY")

parCompany.iDB2DbType = IBM.Data.DB2.iSeries.iDB2DbType.iDB2Char

Dim parOrder As IBM.Data.DB2.iSeries.iDB2Parameter = New IBM.Data.DB2.iSeries.iDB2Parameter

parOrder.ParameterName = "Order"

parOrder.Value = dr.Item("ORDER")

parOrder.iDB2DbType = IBM.Data.DB2.iSeries.iDB2DbType.iDB2Decimal

parOrder.Size = 7

Dim parLine As IBM.Data.DB2.iSeries.iDB2Parameter = New IBM.Data.DB2.iSeries.iDB2Parameter

parLine.ParameterName = "Line"

parLine.Value = dr.Item("O1LINE")

parLine.iDB2DbType = IBM.Data.DB2.iSeries.iDB2DbType.iDB2Decimal

parLine.Size = 3

Dim parOrdValue As IBM.Data.DB2.iSeries.iDB2Parameter = New IBM.Data.DB2.iSeries.iDB2Parameter

parOrdValue.ParameterName = "OrderValue"

parOrdValue.Value = ""

parOrdValue.iDB2DbType = IBM.Data.DB2.iSeries.iDB2DbType.iDB2Decimal

parLine.Size = 17

Dim parType As IBM.Data.DB2.iSeries.iDB2Parameter = New IBM.Data.DB2.iSeries.iDB2Parameter

parType.ParameterName = "Type"

parType.Value = "B"

parType.iDB2DbType = IBM.Data.DB2.iSeries.iDB2DbType.iDB2Char

parLine.Size = 1

Dim parOrdQty As IBM.Data.DB2.iSeries.iDB2Parameter = New IBM.Data.DB2.iSeries.iDB2Parameter

parOrdValue.ParameterName = "OrderQty"

parOrdValue.Value = ""

parOrdValue.iDB2DbType = IBM.Data.DB2.iSeries.iDB2DbType.iDB2Decimal

parLine.Size = 17

prgCmdDB2.ExecuteNonQuery()

All Comments

Leave a comment...

  • 3 Comments
    • Did you ever get a resolution on this?

      I have had similar results trying to call AS/400 RPG programs through the database interface. At times, I have been able to do it. It has been about 3 years since I did this, but here is what I found, as best I can recall.

      If the RPG program I was calling had no arguments, I could call the RPG program as though it were a stored procedure, even though no explicit stored procedure existed. When I had arguments, I couldn't get this to work. There was always something about the datatypes of the arguments it would complain about. Sorry, but I can't remember the details. I found that if I created an explicit stored procedure for the program, I could get it to work. Creating the stored procedure though with the correct datatypes was then the challenge.

      For best results, I recommend you use the iSeries Client Access ActiveX library in cwbx.dll. Here is a link to an article I wrote describing how I was able to use it. I hope it helps.

      http://www.netsplore.com/PublicPortal/Default.aspx?tabid=246

      Good luck.

      #1; Sat, 05 Jan 2008 08:26:00 GMT
    • Hmm... the OPs problem seems to me to be not including the Schema in the call statement. I guess your problem was more advanced than that.
      #3; Sat, 05 Jan 2008 08:28:00 GMT