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



I've also written encapsulated procedures to deal with common SQL needs,
like isSQLError( sqlca ), isSQLWarning( sqlca ), isSQLSuccess( sqlca ),
isSQLRecordNotFound( sqlca ), and such as that. I pass myself the entire
SQLCA since it is handy and contains everything needed including error
message info for my sendSQLException( sqlca ).

Stu




On Mon, Oct 24, 2011 at 17:26, Rory Hewitt <rory.hewitt@xxxxxxxxx> wrote:

Michael,

You say that you have many instances in your code of this check (for a
substring of SQLSTATE).

Have you considered putting the required code into a procedure in a service
program module (and/or ina callable program, if some of these are OPM
programs)? Something like this:

for x = 1 to 10;
exec sql
fetch next
from EPstatusCursor
into :Type;

* if checkSqlState(SQLSTATE) = Success;*
// SQL executed successfully
EquipmentTypes(x) = Type;
else;
NextElement = x;
LEAVE;
endif;
endfor;

That way, there is only one place where these checks need to be made - in
the checkSqlState() procedure. You can also choose to return different
values (Error, Warning, Success), which you can process in your in-line
code
as you wish. Finally, this also gives you one place to invoke any auditing
or logging functionality you might want to put in there (such as writing to
a spooled file or database file if an error occurs.

FWIW, I wrote a procedure like this and you can have the code if you want
(once I dig it out, that is!)...

Just sayin'

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

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.