× 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 for all your responses.

We will be eliminating these files soon so fixing the data in all the numeric fields in all QS36F files really isn't a viable option. Neither is fixing all the old programs.

I think I've found what I was looking for. As is often the case, it was staring me in the face and I didn't see it.
This line...
select substr(F00001,107,3) as cusDrt#
becomes this...
select translate(substr(F00001,107,3),'0',' ') as cusDrt#

This converts any spaces in the "numeric" field to zeros. It's ugly I know, but it works. And I was able to keep it as a single line, not a 5-line Case statement.

Bruce, I'm still interested in your utility. I've downloaded it but haven't unzipped it yet. I believe it will be a great help over the next 6-12 months.

Thanks again to the responders, and to everyone who takes the time to help each other here. Kinda gives you a warm fuzzy feeling, doesn't it?

Timothy Adair
Romans 5:8



"Tim Adair/prairiefarms" <TAdair@xxxxxxxxxxxxxxxx> wrote in message news:mailman.2478.1253117396.1811.rpg400-l@xxxxxxxxxxxxxxx
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



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.