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.
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.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
Answer” if a marked post does not actually answer your question.
rturtlez
Member
5 Points
1 Post
Problem calling an AS400 program from ASP.NET
Feb 10, 2006 04:44 PM|LINK
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()
joerattz
Member
685 Points
163 Posts
Re: Problem calling an AS400 program from ASP.NET
Apr 13, 2006 12:23 PM|LINK
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.
http://www.linqdev.com
http://www.netsplore.com
joerattz
Member
685 Points
163 Posts
Re: Problem calling an AS400 program from ASP.NET
Jan 22, 2007 07:42 PM|LINK
Since I posted that message, I have written another, more advanced article on this same topic:
http://www.netsplore.com/PublicPortal/Blog/tabid/284/EntryID/13/Default.aspx
Thanks.
http://www.linqdev.com
http://www.netsplore.com
TAsunder
Participant
1001 Points
215 Posts
Re: Problem calling an AS400 program from ASP.NET
Jan 31, 2007 11:37 PM|LINK
rambhopalred...
Member
671 Points
214 Posts
Re: Problem calling an AS400 program from ASP.NET
Feb 01, 2010 01:19 PM|LINK
Hi
I believe now i will solve your problem.
http://www.netsplore.com/PublicPortal/Default.aspx?tabid=246
Rambhopal Reddy E
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
Answer” if a marked post does not actually answer your question.
pinkdale
Member
7 Points
6 Posts
Re: Problem calling an AS400 program from ASP.NET
Jul 19, 2010 01:59 AM|LINK
i am getting errors calling a CL program that takes 2 parameters a userid and password, the code below errors out everytime:
Imports cwbx
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim system As New cwbx.AS400System()
Dim str As New cwbx.StringConverter
system.Define("as400")
system.UserID = "qsecofr"
system.Password = "passpass"
system.IPAddress = "192.168.1.2"
system.Connect(cwbx.cwbcoServiceEnum.cwbcoServiceRemoteCmd)
Dim program As New cwbx.Program
program.LibraryName = "qgpl"
program.ProgramName = "PASSWORDCH"
Dim parmlength As Integer
parmlength = 10
Dim paramters As New cwbx.ProgramParameters
paramters.Append("USER", cwbx.cwbrcParameterTypeEnum.cwbrcInput, 10)
paramters.Append("PASSWD", cwbx.cwbrcParameterTypeEnum.cwbrcInput, 10)
' paramters["USER"].vALUE=cwbx.stringConverter.ToBytes("TCBOPR")\
paramters("USER").Value = str.ToBytes("pinkda")
paramters("PASSWD").Value = str.ToBytes("tcbopr")
program.Call(paramters)
End Sub
End Class
<div></div>