× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



In Prepare() calls to verifyConnection() and createRequest() both
succeed since you're not throwing anything in there. But createRequest
calls

[DllImport("cwbdc.dll", EntryPoint="#502",
CallingConvention=CallingConvention.StdCall, CharSet=CharSet.Unicode)]
private static extern int DcDnCreateRequest(int functionNumber, IntPtr
connectionHandle, ref MpDcCreateRequest parms);

So , lets assume that inside Prepare() createRequest() returns
iDB2Command.m_dcRequest != IntPtr.Zero and createSQLForiSeries() does
return and now the param collection count = 1. Looks like

[DllImport("cwbdc.dll", EntryPoint="#503",
CallingConvention=CallingConvention.StdCall, CharSet=CharSet.Unicode)]
private static extern int DcDnPrepare(int functionNumber, IntPtr
requestHandle, ref MpDcPrepare parms, IntPtr p);

is ok since you're not throwing iDB2DCFunctionErrorException.

Now, if (parameterInfo !=0) then you'll only be made aware of a
"warning" if tracing is on, if the RC is an error code then you'll be
throwing and exception here.

So, (parms.parameterCount = 1) so we move on and create a infoArray of
MpDcHostColumnInfo type. No problem.

Then we call GetParameterInfo with the pointer we got from
createRequest. It succeeds since you're not throwing an exception here.
parameterInfo must be = 0 since we're not throwing anything here either.

If m_paramColInfo == null then we create a new MPHostColInfo. Something
we already did back in createSQLforiSeries based on ? parameter marker.

Then we updateHostColumnInfo with the infoArray which we retrieved
earlier... Here is where we actually set the m_sqlType, m_ccsid and
m_length that we will later use inside DeriveParameters(). Keep in mind
infoArray came from unmanaged code.

Then there is another check for parms.rsColumnCount > 0. I can't find
any code that sets rsColumnCount, so I'm assuming we skip it.

Finally the m_preparedSQLStmt is set to m_cmdtext or "SELECT Loan,
CSRUserId, namefornewcard FROM PaymentRequest WHERE PaymentRequestGuid =
?" in your case. Based on CommandType.Text.

So that's it for Prepare()...

Meanwhile back in DeriveParameters() we have m_paramColInfo != null,
yes. So now we iterate through your params:

ParamName is irrelevant, then we get a IDB2Parameter:

iDB2Parameter parameter = this.m_Parameters.Add(new
iDB2Parameter(paramName,
iDB2DbTypeUtility.MapSQLTypeToiDB2DbType(this.m_paramColInfo[j].m_sqlTyp
e, (int) this.m_paramColInfo[j].m_ccsid,
this.m_paramColInfo[j].m_length)));

This is where we crap out. So, since we've gone this far I figure you
need to ask this guy >>>>

[DllImport("cwbdc.dll", EntryPoint="#503",
CallingConvention=CallingConvention.StdCall, CharSet=CharSet.Unicode)]
private static extern int DcDnGetParameterInfo(int functionNumber,
IntPtr requestHandle, [Out] MpDcHostColumnInfo[] parms, IntPtr p);

why its returning an item in the DcSqlTypes enum that
MapSQLTypeToiDB2DBType() can't switch on. Especially the
CWBDC_SQLInvalidType = 8 value.

-chris









-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Steve Richter
Sent: Monday, September 21, 2009 12:38 PM
To: Midrange Systems Technical Discussion
Subject: Re: Occasional .Net InvalidCastException
fromw/inMapSQLTypeToiDB2DbType

On Mon, Sep 21, 2009 at 11:46 AM, Walden H. Leverich
<WaldenL@xxxxxxxxxxxxxxx> wrote:


Look at the stack trace, it's blowing on the DeriveParameter call.
Seems
like i5/OS is returning invalid data. The PaymentRequestGuid is a
char(36) on the i. And we can go through this same code 1000s of times
w/out a problem and then it just screws up.

what about writing the data being returned by server to a temporary
trace file? The plan being to check this file everytime the PC side
bombs out to see if there is something in the data which is causing
the error.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.