sorry i m calling CL program .. cmd.CommandType = CommandType.Text; cmd.CommandText = "CALL AMITS.TST2(@rtnmsg @amount)";but showing SQL0104: Token @RTNMSG was not valid. Valid tokens: :.Cause . . . . . : A syntax error was detected at token @RTNMSG. Token @RTNMSG 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 @RTNMSG. 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.
Since it's a SQL error, it looks like you're calling a SQL stored proc. If the CL program isn't registered as a stored proc, you can't use a SQL CALL statement to call it. (In SQL, it's a CALL statement; not a CALL command. They are different.) Are you intending to use SQL to do this? -- Tom
You can use commands to execute SQL statements or to call stored procedures. If the "program" you are trying to execute doesn't fall into one of those categories, you will not be able to execute it that way.
If it is a stored procedure, then you must use a CommandType of 'StoredProcedure', and the CommandText must contain the name of the stored procedure only.
...you will not be able to execute it that way.
Technically, if the SQL CALL only has input parameters, you can use it to call any program that you have authority to call. (This might be more restricted on i 6.1 or later. I haven't done recent testing.) DB2 for i will process the CALL as if the program was registered as a stored procedure.
It looked as if parms were ouput or in/out in this case. But even if they weren't, the intention of the CALL should be clear in the question if we're to give appropriate help.
Tom
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 5  Replies