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



Thank you Dennis,

It is now working. Initializing the variables fixed the problem but as
you suggest I must look at the effect it have on null value. I will
change the sqlcod to check for end of file. I checked for not 0 as I was
receiving a number of codes other than 100 while testing. Debug helped
to retrieve the values and then fix the problem.

Your feedback is much appreciated.

Regards
Mark

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dennis Lovelady
Sent: Sunday, April 18, 2010 6:44 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: UDTF - Decimal data error

My input filed is fine and I get the correct data when I remove the
packed fields and just leave the char fields. The integer field is
fine
if I use %int.

? Why would you need %Int in this context?

Based upon your responses, I strongly urge you to look at SQLCOD and
SQLSTAT
(which you should do anyway with any SQL function - especially one that
becomes part of the database, such as a UDF). Clearing the DS is a good
idea, but I didn't suggest it since that would mask problems you might
have
with data not received.

I also notice that you are defining but not using null indicators.
You've
got all the infrastructure in place; it would be to your advantage to
use
it.

Consider, for example, that the table column that represents C3's
d3BRNCDE
field is null in the database. If you have not cleared your data
structure,
you will receive a decimal data area when you try to reference it. If
you
have cleared the data structure, your program will proceed as though
nothing
is wrong (and d3BRNCDE will be zero). Is that what you want?

You also have not allowed for the (seemingly) normal possibility of
SQLCOD =
100 (EOF). What do you want to happen if your FETCH receives no data?


Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"There are so many things that we wish we had done yesterday, so few
things
that we feel like doing today."
-- Mignon McLaughlin




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.