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



If you're doing SQLRPGLE, then I suggest bringing the value in as a
character value, and have your RPG code make the decision and conversion.
An error handling routine, which might also work, would have to be coded in
a User Defined Function. You can use the following syntax to handle an
error in conversion, and return a null value, which you can then convert in
your statement using the IFNULL function.


DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
RETURN NULL;
END ;




"Tim
Adair/prairiefarm
s" To
<TAdair@prairiefa rpg400-l@xxxxxxxxxxxx
rms.com> cc
Sent by:
rpg400-l-bounces@ Fax to
midrange.com
Subject
Embedded SQL - cast blank field to
09/16/2009 12:09 zeros
PM


Please respond to
RPG programming
on the IBM i /
System i
<rpg400-l@midrang
e.com>






I've searched the archives for this and haven't been able to find an
answer. I inherited an SQLRPGLE program that reads (using SQL Fetch) an
old QS36F file and writes certain fields to another file. Unfortunately,
S/36 Environment still allows numeric fields to contain blanks (spaces).
When it tries to do a fetch on a record with a blank numeric field, SQL
quietly barfs on itself with status 22018, error -420. I've tried
explicit casting in various forms and none of them work. I've also added
and H-spec fixnbr(*zoned) which apparently has no effect on embedded SQL

Is there a simple way to get around this? I know I can do case logic for
each numeric field -

case
when substr(F00001,501,6) > '000000'
then substr(F00001,501,6)
else '000000'
end

But there are dozens of numeric fields in this file. And there are a
multitude of programs similar to this, waiting in the wings.

Any help would be greatly appreciated. I'm running out of aspirin.

TIA.

Timothy Adair

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-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.