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



You can use the DESCRIBE function to retrieve the numbers of columns in the 
result set, and the data type and length of each column in the result set.

You can also use the SQLDA DS to retrieve the data and such information. But 
then you have to map to the retrieving host variable with a pointer. I use an 
array for this, for each data type a seperate field. the number of the column 
is the index to the array. So you can define a packed field in the array as 30 
9 decimals, pass the pointer of  that array element  into the SQLDA DS  (this 
DS also contains an array), do a fetch and based on the data type pass the 
correct subfield in the array into your output variable.

I am aware using the SQLDA can be aliitle cumbersome to define and use, but 
once set up you can even pass variable data to the  OPEN function for record 
selection.

The SQL Reference manual Appendix C (IIRC) has the lay out of the SQLDA and the 
data types returned by SQL (an integer, two for each data type, one for null 
capable coulmns).

Regards,
Carel Teijgeler   

*********** REPLY SEPARATOR  ***********

On 8-4-05 at 12:51 Pete Helgren wrote:

>Using embedded SQL in RPG IV.  V5R2M0.....
>
>I get an SQLCOD = -000000303 with SQLSTT = '42806' which is telling me I have 
>a host variable that is incompatible ("A value >cannot be assigned to a host 
>variable, because the data types are not compatible.")
>
>OK...that doesn't surprise me, I have some numeric data coming in and I guess 
>that I defined the host variable incorrectly.
>
>So, two questions arise:
>
>1.How can I tell which, of the 11 fields in my select statement, is causing 
>the error? and...
>
>2. Is there an "easy" way to define host variables (or some 'trick' I can use) 
>so that my selected fields from the tables match the host 
>variables I select them into?
>
>Am I making this too hard?  In Java I can "point" my results to a result 
>set (rs) and then access them using rs.field1, rs.field2, rs.field3, 
>etc.  Mapping the select statement into host variables is a drag in 
>RPG.  Perhaps there is an easier way? I am all ears....
>
>Thanks,
>
>Pete Helgren
>
>
>-- 
>This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
>To post a message email: MIDRANGE-L@xxxxxxxxxxxx
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/midrange-l
>or email: MIDRANGE-L-request@xxxxxxxxxxxx
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/midrange-l.





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.