Download Latest Version tpc-c-ifmx.tar.gz (392.7 kB)
Email in envelope

Get an email when there's a new version of IIUG Software Repository

Home / ESQL / chkmsg
Name Modified Size InfoDownloads / Week
Parent folder
chkmsg.ec 2020-05-11 2.2 kB
getopt.h 2020-05-11 1.8 kB
range2.c 2020-05-11 1.9 kB
range.h 2020-05-11 1.8 kB
readme.txt 2020-05-11 3.3 kB
stderr.c 2020-05-11 7.2 kB
stderr.h 2020-05-11 2.4 kB
Totals: 7 Items   20.5 kB 0
From: Jonathan Leffler <jleffler@informix.com>
Date: Tue, 20 Oct 1998 09:26:09 -0700 (PDT)

On Tue, 20 Oct 1998, John H. Frantz wrote:

> finderr 100 shows me the duplicate value message.
> finderr -100 also shows me this.

Unless you put an explicit + in front of the number, finderr interprets
numbers as error numbers, and hence as negative.

> finderr +100 shows me a no matching record message (i.e. not found).

It could, equivalently, have shown the duplicate value message.
C-ISAM can return iserrno = +100 for the duplicate value error.

Note that finderr simply (well, not all that simply) greps through a
text file to produce the text of an error message.  By contrast, rgetmsg()
goes to the actual iem-file for the raw message.

> Apparently finderr assumes a negative value unless otherwise specified.

Yes.

> I'm not sure about rgetmsg() but if it accepts the message number as an
> integer then it may always assume a negative number, dealing only with
> messages categorized as errors.

No!  rgetmsg() interprets the number you supply as the number you supply.
Internally, Informix code uses positive numbers for messages (including
things like menu options), and negative numbers for errors.

> Art S. Kagel wrote:
> > Henry A.L. Wollman wrote:
> > > How come rgetmsg returns the wrong description for an error code 100? It
> > > should be "not found" but instead returns something about a duplicate
> > > value on insert or update of a unique key.
> > >
> > > Are there other error codes for which rgetmsg returns the wrong
> > > description? It seems that even the manual as far back as several years
> > > ago has the wrong message for a 100. Aren't these things ever fixed? Is
> > > rgetmsg not a reliable function? Must I write my own?
> > 
> > There is nothing to fix since nothing is broken!
> > 
> > Rgetmsg does not return the wrong message.  SQLNOTFOUND, or 100 is NOT
> > an error, however, there IS an ISAM error -100 which is described as:
> > 
> > -100    ISAM error: duplicate value for a record with a unique key.
> > 
> > It is a convenience that finderr and rgetmsg return the message whether
> > you enter the message number as positive or negative, but remember that
> > ALL error message numbers are negative!  SQLNOTFOUND is an INDICATOR
> > that there is no more data to fetch NOT and error caused by fetching
> > beyond the end of the select set.

I threatened to send a chkmsg() program to c.d.i; I'm now carrying out that
threat.  I'm not all that keen on the way it uses getopt(), but it more or
less works.  To compile:

	esql -o chkmsg chkmsg.ec range2.c stderr.c

To use:
	chkmsg 100
	chkmsg +100
	chkmsg -100
	chkmsg -100:+100
	chkmsg -100..+100

This is a direct interface to rgetmsg(), so you can see what messages are
really in the message files.  You might care to note that both +100 and
-100 produce the same message text:

	-100: ISAM error:  duplicate value for a record with unique key.
	100: ISAM error:  duplicate value for a record with unique key.

Yours,
Jonathan Leffler (jleffler@informix.com) #include <witticism.h>
Guardian of DBD::Informix v0.60 -- http://www.perl.com/CPAN
Informix IDN for D4GL & Linux -- http://www.informix.com/idn

PS: I think this might be useful in the IIUG software archives.

:	"@(#): shar.sh,v 2.1 1998/06/02 17:13:43 jleffler Exp $"
Source: readme.txt, updated 2020-05-11