iSeries stored procedure isn’t returning value when calling RPG program

351845 pts.
Tags:
IBM iSeries
RPG
SQLRPGLE
Stored Procedures
Our team currently has a stored procedure that calls an SQLRPGLE program. It's running great as we have verified the debugger and it sends the return value as expected. But the problem is what is returned when we're looking at cmd.Parameters["@ISMATCH"].Value = {} Here's our stored procedure:
CREATE PROCEDURE "MPRLIB"."CHECKHOURS" (EMPLOYEEID DECIMAL(10 , 0), 
    INOUT ISMATCH CHAR(1))
LANGUAGE RPGLE
PARAMETER STYLE SQL
NOT DETERMINISTIC
MODIFIES SQL DATA 
SPECIFIC CHECKHOURS 
NEW SAVEPOINT LEVEL
EXTERNAL NAME 'MPRLIB/MPRLRCHK';
Here's our method too:
  public bool IsValidTimesheet(int id)
    {
        bool isValid = false;

        // Get the data from the iSeries
        using (iDB2Connection conn = new iDB2Connection(ConfigurationManager.ConnectionStrings["IbmIConnectionString"].ConnectionString))
        {
            using (iDB2Command cmd = conn.CreateCommand())
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "LIB.CHECKHOURS";

                cmd.Parameters.Add("@EMPLOYEEID", iDB2DbType.iDB2Decimal).Value = id;
                cmd.Parameters.Add("@ISMATCH", iDB2DbType.iDB2Char).Direction = ParameterDirection.Output;
                conn.Open();
                cmd.ExecuteNonQuery();
                isValid = (cmd.Parameters["@ISMATCH"].Value.ToString() == "1") ? true : false;
                conn.Close();
            }
        }

        return isValid;
    }
Thanks! Let us know if there's anything you need.

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta

    But the problem is what is returned when we're looking a

    And when you look at it, what is the problem that you see?

    However, I'd guess the first thing that should is to correct the stored proc definition:

    PARAMETER STYLE SQL

    Because this is not a SQL stored proc but rather an external one, your parameter style should probably be:

    PARAMETER STYLE GENERAL

    I can't be sure about that since you didn't show how the RPG interface is defined, but chances are good that it doesn't include everything that a SQL procedure would handle. For SQL, there can be many hidden internal parameters other than just your declared ones.

    Tom


    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following