Never ever check for SQLCODE = *Zeros or SQLSTATE = '00000' but for:
SQLCODE < *Zeros (Error) and SQLCODE = 100 (Not Found)
Or
Subtr(SQLSTATE, 1, 2) <> 00, 01, 02 and Substr(SQLSTATE, 1, 2) = '02' (Not
Found)
SQL may throw some warnings SQLCODE > *Zeros and SQLCODE <> 100 or
Substr(SQLSTATE, 1, 2) = '01'. Eventhoug a warning is sent, the data is
returned correctly.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Buck
Calabro
Gesendet: Thursday, 08.1 2015 16:06
An: midrange-l@xxxxxxxxxxxx
Betreff: Re: AW: Don't believe SQL debug joblog
On 1/8/2015 1:03 AM, Birgitta Hauser wrote:
If you convert a fixed length character field by using the scalar
function COALESCE, the result is returned as VARCHAR.
Yes, due to a string constant being considered a varying-length character
string (per SQL Reference, Constants). If they'd say VARCHAR it would be
clearer, and I left feedback.
When fetching this result into a fixed length field, data conversion
occurs.
So message SQL7919 is correct.
Explicitly casting the result of COALESCE into a fixed length
character removed the message.
BTW message SQL7919 is not even a warning but only an information message.
Yes.
The reason I was in debug was that the code did a FETCH and then a check for
SQLSTATE='00000'. It wasn't; it was 01004 (truncation). The problem with
me following the joblog was that there were actually TWO warnings, not one.
One was the harmless SQL7919 and the other was SQLSTATE 01004. The SQLSTATE
did NOT put any message into the joblog; there was only one joblog message
and I stupidly assumed that it paired up with the SQLSTATE 01004.
It didn't. SQLSTATE was my problem, and I should have ignored the joblog.
I should have known better.
--
--buck
'I had nothing to offer anybody except my own confusion' - Jack Kerouac
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.