× 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 started using SQLCOD because it was more comfortable (i.e. MSGF
etc...)

But I soon discovered that there are errors that are not covered by
SQLCOD that are covered by SQLSTT (can't remember which ones at this
moment).

So here is my advice always, ALWAYS test SQLSTT.  But, utilize the
SQLCOD to build those unexpected or expected messages.

Another plug for SQLSTT, which is ANSI compliant, let's say your client
(receiver of error message) isn't on the AS/400, SQLCOD is very foreign.



-----Original Message-----
From: BrgttHsr@aol.com [mailto:BrgttHsr@aol.com]
Sent: Friday, October 18, 2002 8:10 AM
To: rpg400-l@midrange.com
Subject: Re: Error Handling in SQLRPGLE Programs

--
[ Picked text/plain from multipart/alternative ]
Hi Bob,

SQLCOD 1-99 are warnings
SQLCOD < 0   are SQL-Errors.

If I want to display a SQL-Error-Message, I use the following trick:
All SQL-Messages are in the QSQLMSG Message-File
The Message-Id of an SQL-Error is SQL + absolute value of SQLCOD.
(SQLCOD -302 --> 'SQL0302')

On the other hand I wouldn't use WHENEVER, i prefere a simple IF in my
RPG-Program:

C                   Do       *HiVal

C/EXEC SQL
C+ Fetch SqlSKR into :DS_SQLSK
c/END-EXEC

C                   if        SQLCOD      = 100
C                   leave
C                   endif

C                   if        SQLCOD      < 0
C                   eval      MsgId      = 'CPF9898'
C                   eval      MsgTxt    = RtvSqlMsg(SQLCOD)
C                   exsr     SndPgmMsg
C                   leave
C                   endif

I hope that helps

Birgitta Hauser

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
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 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.