Based on the provided information, it seems that there might be an issue with how the output parameters are bound or how the stored procedure is being called. Here are a few things to check and consider:
- SQL Server Stored Procedure Definition: Verify that the stored procedure
est_proc
is correctly defined in SQL Server and that it indeed has three output parameters:retValue
,count
, andaction
. Ensure that the data types and sizes of the output parameters match the ones used in the C program. - SQLBindParameter Parameters: Check the parameters passed to the SQLBindParameter function. Ensure that the parameter numbers and data types match the ones expected by the stored procedure. For example, ensure that the parameter number for
retValue
is 1, forcount
is 3, and foraction
is 4. - Error Handling: Check for any error codes returned by the ODBC functions, including SQLBindParameter and SQLExecDirect. Make sure to handle any potential errors appropriately. You can use SQLGetDiagRec to retrieve error information for diagnosis.
- Output Buffer Sizes: Ensure that the output buffer sizes for the variables
retValue
,count
, andaction
are large enough to hold the data returned by the stored procedure. The buffer size should be at least the size of the data type. - ODBC Driver Compatibility: Verify that the version of the MS ODBC driver 18 for SQL Server (msodbcsql18-18.1.1.1-1.x86_64.rpm) is compatible with SQL Server 2019. It's essential to use a compatible ODBC driver version with the corresponding SQL Server version.
- Stored Procedure Execution: Double-check that the stored procedure is executed correctly using the SQLExecDirect function. Ensure that the parameters are passed in the correct order and that the procedure is called as expected.
- Stored Procedure Behavior: Examine the behavior of the stored procedure itself. Make sure there are no issues with the logic inside the procedure that might affect the output parameter values.
- Debugging: Consider adding additional debug information in your C program to trace the values of the output parameters before and after the stored procedure call. This can help identify any unexpected behavior.
If you have verified all the above aspects and the issue persists, it might be helpful to consult the official documentation of the MS ODBC driver, review any relevant Microsoft support articles, or reach out to their support team for further assistance with the specific version of the ODBC driver and SQL Server being used.