473,396 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help again

This thing is about to drive me crazy. I have about 50 queries in the AS400
that I need to put on a menu. Once I conquer this I have a bunch more rpg
reports that I need to pass a date to. In the AS400 I have a stored
procedure (SPRUNQRY) that runs the RUNQRY command with the name of the query
as a parameter. In the AS400 I would type "RUNQRY SUNTR401A" on a command
line to run this query. My connection is opening, and I can run some reports
that do not have any parameters. My VB.net 2003 is:

'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter("cmdparm1", iDB2DbType.iDB2VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmdparm1.Direction = ParameterDirection.Output

cmd.Parameters.Add(cmdparm1)

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "{CALL hteusrj/sprunqry ( ? )}"

Try

cmd.ExecuteNonQuery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKOnly, "OK")

Exit Sub

End Try

This catches an error when it tries to execute the command The error says:
{IBM.Data.DB2.iSeries.iDB2SQLErrorException}

and also: message code -104 and message: "SQL0104 Token {was not valid.
Valid tokens : : <IDENTIFIER>."

I can't figure out exactly what it wants. I could sure use some help, I've
spun my wheels for several days on this.

Thanks in advance,

Joe in Florida


Jan 29 '07 #1
3 4073

The parameter direction should be input. (That's the default, so I would
just eliminate that line). That indicates whether you are sending into *in*
to the SP or if you're getting something back. Output Parameters are
usually used for getting back autoincrement values assigned to inserted
records.

You command text needs to *not* have curly braces in it; it looks like
that's what the AS400 is kicking back. The CommandText needs to be the
*name* of the stored procedure that you are running, so if
"hteusrj/sprunqry" is really the name of the stored procedure in the
database, I think this will work:

cmd.CommandText = "hteusrj/sprunqry"

Does that work?

Robin S.
---------------------------------------------
"Darth Ferret" <no***********@nowhere.comwrote in message
news:OB**************@TK2MSFTNGP02.phx.gbl...
This thing is about to drive me crazy. I have about 50 queries in the
AS400 that I need to put on a menu. Once I conquer this I have a bunch
more rpg reports that I need to pass a date to. In the AS400 I have a
stored procedure (SPRUNQRY) that runs the RUNQRY command with the name of
the query as a parameter. In the AS400 I would type "RUNQRY SUNTR401A" on
a command line to run this query. My connection is opening, and I can run
some reports that do not have any parameters. My VB.net 2003 is:

'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter("cmdparm1", iDB2DbType.iDB2VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmdparm1.Direction = ParameterDirection.Output

cmd.Parameters.Add(cmdparm1)

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "{CALL hteusrj/sprunqry ( ? )}"

Try

cmd.ExecuteNonQuery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKOnly, "OK")

Exit Sub

End Try

This catches an error when it tries to execute the command The error
says: {IBM.Data.DB2.iSeries.iDB2SQLErrorException}

and also: message code -104 and message: "SQL0104 Token {was not valid.
Valid tokens : : <IDENTIFIER>."

I can't figure out exactly what it wants. I could sure use some help,
I've spun my wheels for several days on this.

Thanks in advance,

Joe in Florida


Jan 29 '07 #2
Thank you for your help Robin,

I made the changes and received the message below the code about a qualified
object. On a lark I tried using hteusrj.spcrunqry with a period instead of a
slash and it just hangs:
'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter("cmdparm1", iDB2DbType.iDB2VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmd.Parameters.Add(cmdparm1)

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "hteusrj/sprunqry"

Try

cmd.ExecuteNonQuery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKOnly, "OK")

Exit Sub

End Try

=========================

Message "SQL5016 Qualified object name SPRUNQRY not valid." String

It's getting closer. MessageDetails "Cause . . . . . : One of the
following has occurred: -- The syntax used for the qualified object name is
not valid for the naming option specified. With system naming, the
qualified form of an object name is schema-name/object-name. With SQL
naming the qualified form of an object name is
authorization-name.object-name. -- The syntax used for the qualified object
name is not allowed. User-defined types cannot be qualified with the schema
in the system naming convention on parameters and SQL variables of an SQL
procedure or function. Recovery . . . : Do one of the following and try
the request again: -- If you want to use the SQL naming convention, verify
the SQL naming option in the appropriate SQL command and qualify the object
names in the form authorization-id.object-name. -- If you want to use the
system naming convention, specify the system naming option in the
appropriate SQL command and qualify the object names in the form
schema-name/object-name. -- With the system naming convention, ensure the
user-defined types specified for parameters and variables in an SQL routine
can be found in the current path." String

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:5r******************************@comcast.com. ..
>
The parameter direction should be input. (That's the default, so I would
just eliminate that line). That indicates whether you are sending into
*in* to the SP or if you're getting something back. Output Parameters are
usually used for getting back autoincrement values assigned to inserted
records.

You command text needs to *not* have curly braces in it; it looks like
that's what the AS400 is kicking back. The CommandText needs to be the
*name* of the stored procedure that you are running, so if
"hteusrj/sprunqry" is really the name of the stored procedure in the
database, I think this will work:

cmd.CommandText = "hteusrj/sprunqry"

Does that work?

Robin S.
---------------------------------------------
"Darth Ferret" <no***********@nowhere.comwrote in message
news:OB**************@TK2MSFTNGP02.phx.gbl...
>This thing is about to drive me crazy. I have about 50 queries in the
AS400 that I need to put on a menu. Once I conquer this I have a bunch
more rpg reports that I need to pass a date to. In the AS400 I have a
stored procedure (SPRUNQRY) that runs the RUNQRY command with the name of
the query as a parameter. In the AS400 I would type "RUNQRY SUNTR401A" on
a command line to run this query. My connection is opening, and I can run
some reports that do not have any parameters. My VB.net 2003 is:

'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter("cmdparm1", iDB2DbType.iDB2VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmdparm1.Direction = ParameterDirection.Output

cmd.Parameters.Add(cmdparm1)

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "{CALL hteusrj/sprunqry ( ? )}"

Try

cmd.ExecuteNonQuery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKOnly, "OK")

Exit Sub

End Try

This catches an error when it tries to execute the command The error
says: {IBM.Data.DB2.iSeries.iDB2SQLErrorException}

and also: message code -104 and message: "SQL0104 Token {was not valid.
Valid tokens : : <IDENTIFIER>."

I can't figure out exactly what it wants. I could sure use some help,
I've spun my wheels for several days on this.

Thanks in advance,

Joe in Florida



Jan 29 '07 #3
What is the name of the parameter in the stored procedure? For example,
this is a stored procedure from SQLServer, and the parameter name is
@CustomerID. So when I add a parameter to my parameterlist containing the
value for this, I have to call the parameter @CustomerID. Is yours really
called "cmdparm1" on the database side?

SELECT CustomerID,
LastName,
FirstName,
Address,
City,
State,
Zip,
Phone
FROM Customer
WHERE (CustomerID = @CustomerID)

And is the stored procedure *really* called "hteusrv/spcrunqry" ? I ask
because I've never seen a stored procedure name with a slash in it.

Robin S.
--------------------------------------------

"Darth Ferret" <no***********@nowhere.comwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
Thank you for your help Robin,

I made the changes and received the message below the code about a
qualified object. On a lark I tried using hteusrj.spcrunqry with a period
instead of a slash and it just hangs:
'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter("cmdparm1", iDB2DbType.iDB2VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmd.Parameters.Add(cmdparm1)

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "hteusrj/sprunqry"

Try

cmd.ExecuteNonQuery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKOnly, "OK")

Exit Sub

End Try

=========================

Message "SQL5016 Qualified object name SPRUNQRY not valid." String

It's getting closer. MessageDetails "Cause . . . . . : One of the
following has occurred: -- The syntax used for the qualified object name
is not valid for the naming option specified. With system naming, the
qualified form of an object name is schema-name/object-name. With SQL
naming the qualified form of an object name is
authorization-name.object-name. -- The syntax used for the qualified
object name is not allowed. User-defined types cannot be qualified with
the schema in the system naming convention on parameters and SQL
variables of an SQL procedure or function. Recovery . . . : Do one of
the following and try the request again: -- If you want to use the SQL
naming convention, verify the SQL naming option in the appropriate SQL
command and qualify the object names in the form
authorization-id.object-name. -- If you want to use the system naming
convention, specify the system naming option in the appropriate SQL
command and qualify the object names in the form
schema-name/object-name. -- With the system naming convention, ensure the
user-defined types specified for parameters and variables in an SQL
routine can be found in the current path." String

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:5r******************************@comcast.com. ..
>>
The parameter direction should be input. (That's the default, so I would
just eliminate that line). That indicates whether you are sending into
*in* to the SP or if you're getting something back. Output Parameters
are usually used for getting back autoincrement values assigned to
inserted records.

You command text needs to *not* have curly braces in it; it looks like
that's what the AS400 is kicking back. The CommandText needs to be the
*name* of the stored procedure that you are running, so if
"hteusrj/sprunqry" is really the name of the stored procedure in the
database, I think this will work:

cmd.CommandText = "hteusrj/sprunqry"

Does that work?

Robin S.
---------------------------------------------
"Darth Ferret" <no***********@nowhere.comwrote in message
news:OB**************@TK2MSFTNGP02.phx.gbl...
>>This thing is about to drive me crazy. I have about 50 queries in the
AS400 that I need to put on a menu. Once I conquer this I have a bunch
more rpg reports that I need to pass a date to. In the AS400 I have a
stored procedure (SPRUNQRY) that runs the RUNQRY command with the name
of the query as a parameter. In the AS400 I would type "RUNQRY
SUNTR401A" on a command line to run this query. My connection is
opening, and I can run some reports that do not have any parameters. My
VB.net 2003 is:

'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter("cmdparm1", iDB2DbType.iDB2VarChar,
9)

cmdparm1.Value = "SUNTR401A"

cmdparm1.Direction = ParameterDirection.Output

cmd.Parameters.Add(cmdparm1)

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "{CALL hteusrj/sprunqry ( ? )}"

Try

cmd.ExecuteNonQuery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKOnly, "OK")

Exit Sub

End Try

This catches an error when it tries to execute the command The error
says: {IBM.Data.DB2.iSeries.iDB2SQLErrorException}

and also: message code -104 and message: "SQL0104 Token {was not valid.
Valid tokens : : <IDENTIFIER>."

I can't figure out exactly what it wants. I could sure use some help,
I've spun my wheels for several days on this.

Thanks in advance,

Joe in Florida




Jan 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: xuatla | last post by:
Hi, I encountered the following compile error of c++ and hope to get your help. test2.cpp: In member function `CTest CTest::operator+=(CTest&)': test2.cpp:79: error: no match for 'operator='...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
6
by: Mark Reed | last post by:
Hi all, I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a little too effective and...
27
by: SK | last post by:
Hi I am trying to teach myself how to program in C. I am a physician hoping to be able to help restructure my office. Anyhow, I amhoping that the porblem I am having is simple to those much more...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
13
by: Chua Wen Ching | last post by:
Hi there, I saw this article here in vb.net. http://www.error-bank.com/microsoft.public.dotnet.languages.vb.1/148992_Thread.aspx and ...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
2
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.