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



What I do not know is an easy way to tell which Select
statement caused the error in the first place. Unlike
normal errors that show you the program name and line
number, the SQL errors always seem to reference a SQL
program - QSQRUN2. With all of the service programs
and SQL we have in use, it can be a nightmare tracking
down and testing every possible SQL to see if it is the offender.
Sometimes I get lucky and there is another job log message
nearby that does reference the correct program, but not always.

You probably won't like my answer, David, especially since it does not solve
the problem at hand - but I'll say it anyway. This is a primary reason that
all SQL statements should be followed by a test for SQLCOD that they then
manage - including failing the program with an appropriate message to the
joblog if appropriate. One should never, ever trust that any SQL statement
has completed successfully.

I have a pretty good routine with the following parameters:
checkSQL
IS_EOF_OK (indicator) Value
FAIL_IF_WARNING (indicator) Value
StatementID (Char 32) Value Varying

Then, religiously, after every SQL statement you see code like this:

EXEC SQL ... some statement ;
checkSQL(EOF_NOT_OK: SQL_ABORT_ON_ERROR: 'Preparing Fetch 1') ;

(as you can guess, checkSQL writes errors and warnings to the joblog. I'm
happy to share if you like. (This routine is destined for my shared code
anyway.)

some programmers think it is perfectly ok to just chain
your way through a subfile until you hit an invalid RRN
-- how hard is it to keep track of the last RRN anyhow??

Rhetorical. How hard is it to check SQLCOD? :)

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"When a person with experience meets a person with money, the person with
experience will get the money. And the person with the money will get some
experience."
-- Leonard Lauder



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.