Calling AS400 program from vb.net

S

Sam

Here is what I'm currently doing.

'Global variable set in the form load
Private g_cnnISeries As New IBM.Data.DB2.iSeries.iDB2Connection

Dim cmdAddData As New IBM.Data.DB2.iSeries.iDB2Command
cmdAddData .Connection = g_cnnISeries
cmdAddData .CommandText = "call mydatalibrary.QCMDEXC('call
PGM(ADDDATA) PARM(3, 'ABC')"

g_cnnISeries.Open()
If g_cnnISeries.State = ConnectionState.Open Then
cmdAddBenefits.ExecuteNonQuery()
g_cnnISeries.Close()
End If

I get an error saying the sql text in not valid. I am able to do a
select statement and insert SQL statement into the database, but this
is a program I want to call, so I'm not exactly sure what the syntax
should be. I've just guessed based on what I could find on the net.

I want to call the program ADDDATA and pass 2 parameters: 3 (integer)
and ABC (string).

Thanks...
 
S

Sam

I tried

cmdAddBenefits.CommandText = "call qsys.QCMDEXC('CALL
PGM(MyDataLibrary/ADDDATA) PARM(3 'XXX')', 0000000070.00000)"

but that just gave me an error saying
"Cause . . . . . : A syntax error was detected at token XXX. Token
XXX is not a valid token. A partial list of valid tokens is ) ,.
This list assumes that the statement is correct up to the token. The
error may be earlier in the statement, but the syntax of the statement
appears to be valid up to this point. Recovery . . . : Do one or
more of the following and try the request again: -- Verify the SQL
statement in the area of the token XXX. Correct the statement. The
error could be a missing comma or quotation mark, it could be a
misspelled word, or it could be related to the order of clauses. -- If
the error token is <END-OF-STATEMENT>, correct the SQL statement
because it does not end with a valid clause."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top