When I calling AS400 stored procedure from C# application I get this error MSG - ERROR [42S02] [IBM][Client Access Express ODBC Driver (32-bit)][DB2/400 SQL]SQL0204 - GVSP07 in TESTGV type *N not found.

Please anyone can help me??????

 OpenODBCConnection();

        OdbcCommand cmd = new OdbcCommand();
        cmd.Connection =conOdbc;


        OdbcCommand ODBC = new OdbcCommand("call TESTGV.GVSP07('TESTGV AMAIN1')", conOdbc);
        ODBC.Parameters.Add("GR1X", OdbcType.Double, 7);
        ODBC.Parameters["GR1X"].Direction = ParameterDirection.Input;
        ODBC.Parameters["GR1X"].Value = 3020;

        ODBC.Parameters.Add("GUSX", OdbcType.Char, 10);
        ODBC.Parameters["GUSX"].Direction = ParameterDirection.Input;
        ODBC.Parameters["GUSX"].Value = "g";
        ODBC.CommandType = CommandType.StoredProcedure;
        ODBC.ExecuteNonQuery();

I don't have much experience with DB2, but found the following:

Client Access ODBC: Common External Stored Procedure Errors

Error: [DB2/400 SQL]SQL0204 - in type *N not found

This error is generated when preparing or running a stored procedure if the call uses parameter markers and the server is unable to find a valid declaration of the stored procedure. As mentioned in "defining stored procedures" section, if a stored procedure call uses parameter markers then the procedure must be defined. This applies even if the application does not describe the parameter. If CREATE PROCEDURE was used, run a query over QSYS2/SYSPROCS to verify the create procedure was run correctly. SPECIFIC_SCHEMA and ROUTINE_SCHEMA must match the library used on the call in the PC application. EXTERNAL_NAME must resolve to the actual program name. The parameter descriptions must also be correct. The SQLProcedures and SQLProcedureColumns ODBC APIs can also be used to retrieve the catalog information. If the older DECLARE PROCEDURE was used, then you must use extended dynamic support to return output or input output parameters. The call of the stored procedure must be stored in the active package. Use PRTSQLINF on the package to verify its contents. Delete the SQL package after making any change to declare procedure. Parameter descriptions are stored in the package as part of the call entry, not the declare entry. DECLARE PROCEDURE takes precedence over CREATE PROCEDURE. Delete the package if the problem persists. Changes to the SQL PATH job setting at V4R5M0 and V5R1M0, specifically changes to how unqualified SQL CALL statements are resolved can also result in this error. Note: With earlier versions of OS/400 and Client Access this error was reported as "Internal Driver Error".

Listing of SQL Messages

Search for "SQL0204":
"...The function will not be found unless the external name and usage name match exactly. Examine the job log for a message that gives more details on which function name is being searched for and the name that did not match..."

"... If an external function was not found, be sure that the case of the EXTERNAL NAME on the CREATE FUNCTION statement exactly matches the case of the name exported by the service program..."

Edited 2 Years Ago by cgeier

This article has been dead for over six months. Start a new discussion instead.