× 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.



Thanks Scott.
That fixed the problem.
 
I appreciate all the help you have provided.
 
Jeff Young

----- Original Message ----
From: Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Cc: midrange-l@xxxxxxxxxxxx
Sent: Monday, August 14, 2006 1:19:00 PM
Subject: Re: SQL CLI Error


Hi Jeff

You have misplaced the parenthesis in the 5th parameter of the following 
statement:

  Rc = SQLBindCol( Stmt
                 : 6
                 : SQL_DECIMAL
                 : %Addr(Row(1).AvgTyr )
                 : %Len(Row(1).AvgTyr * 256) + %DecPos(Row(1).AvgTYr)
                 : F6) ;

You don't want %len(x*256)!  you want %len(x) * 256.

The former statement says "how big of a variable would I need to store the 
result of x*256?"  The latter says "how big of a variable is x?  Multiply 
that by 256."

For example, if x is a 5,2 field containing 500.00.  %len(500 * 256) = 6 
(since 500*256 = 128000 which is 6 digits)  however, %len(x)*256 = 1280 
since %len(x)=5, and 5*256 = 1280.

To fix your code, move the parenthesis so you're multiplying the result of 
the %LEN BIF by 256 instead of multiplying the input to the %LEN BIF.  For 
example:

                 : %Len(Row(1).AvgTyr) * 256 + %DecPos(Row(1).AvgTYr)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.